| 123 | const ASTNode *ASTDefNode::getAssigned() const { return Assigned.get(); } |
| 124 | |
| 125 | const ASTNode *ASTDefNode::getNodeForType() const { |
| 126 | if (!Assigned) |
| 127 | return Assignee.get(); |
| 128 | |
| 129 | assert(Assignee && "Unexpected Program State"); |
| 130 | if ((Assignee->getNodeType() == ASTNode::CALL) && |
| 131 | (Assigned->getNodeType() != ASTNode::CALL)) |
| 132 | return Assigned.get(); |
| 133 | |
| 134 | if (const auto *E = Assigned->getNode().get<Expr>()) { |
| 135 | if (E->isNullPointerConstant(Assigned->getASTUnit().getASTContext(), |
| 136 | Expr::NPC_NeverValueDependent)) { |
| 137 | return Assignee.get(); |
| 138 | } |
| 139 | } |
| 140 | return Assigned.get(); |
| 141 | } |
| 142 | |
| 143 | llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const ASTDefNode &Src) { |
| 144 | O << "Index: " << Src.getLocIndex().getIDAsString() << "\n" |
no test coverage detected