| 8 | namespace ftg { |
| 9 | |
| 10 | ASTDefNode::ASTDefNode(VarDecl &D, ASTUnit &Unit) { |
| 11 | Assignee = |
| 12 | std::make_unique<ASTNode>(ASTNode::DECL, DynTypedNode::create(D), Unit); |
| 13 | if (!Assignee) |
| 14 | throw std::runtime_error("Failed to create ASTDeclNode"); |
| 15 | |
| 16 | if (auto *E = D.getInit()) { |
| 17 | Assigned = std::make_unique<ASTNode>(ASTNode::STMT, |
| 18 | DynTypedNode::create(*E), Unit); |
| 19 | assert(Assigned && "Unexpected Program State"); |
| 20 | |
| 21 | // NOTE: If initializer of declaration has same location as declaration, |
| 22 | // it should be considered as implicitly generated initializer. |
| 23 | // Thus, it should be considered that it has no intiizlier. |
| 24 | if (Assignee->getIndex() == Assigned->getIndex()) |
| 25 | Assigned.reset(); |
| 26 | } |
| 27 | SourceLoc = LocIndex(Unit.getSourceManager(), D.getLocation()); |
| 28 | } |
| 29 | |
| 30 | ASTDefNode::ASTDefNode(BinaryOperator &B, ASTUnit &Unit) { |
| 31 | if (!B.isAssignmentOp()) |
nothing calls this directly
no test coverage detected