| 63 | } |
| 64 | |
| 65 | SourceLocation |
| 66 | ASTNode::getBeginLoc(const DynTypedNode &Node, |
| 67 | const clang::SourceManager &SrcManager) const { |
| 68 | SourceLocation Result; |
| 69 | if (const auto *AST = Node.get<Decl>()) |
| 70 | Result = AST->getLocation(); |
| 71 | else if (const auto *AST = Node.get<CXXCtorInitializer>()) |
| 72 | Result = AST->getSourceRange().getBegin(); |
| 73 | else if (const auto *AST = Node.get<CXXOperatorCallExpr>()) |
| 74 | Result = AST->getOperatorLoc(); |
| 75 | else if (const auto *AST = Node.get<CXXMemberCallExpr>()) |
| 76 | Result = AST->getExprLoc(); |
| 77 | else if (const auto *AST = Node.get<Stmt>()) |
| 78 | Result = AST->getBeginLoc(); |
| 79 | else |
| 80 | assert(false && "Unimplemented"); |
| 81 | return SrcManager.getTopMacroCallerLoc(Result); |
| 82 | } |
| 83 | |
| 84 | SourceLocation ASTNode::getEndLoc(const DynTypedNode &Node, |
| 85 | const SourceLocation &BeginLoc, |
no outgoing calls