Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -240,12 +240,14 @@ /// class Y {}; /// \endcode /// -/// Usable as: Matcher, Matcher, Matcher +/// Usable as: Matcher, Matcher, Matcher, +/// Matcher AST_POLYMORPHIC_MATCHER(isExpansionInMainFile, - AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) { + AST_POLYMORPHIC_SUPPORTED_TYPES( + Decl, Stmt, TypeLoc, NestedNameSpecifierLoc)) { auto &SourceManager = Finder->getASTContext().getSourceManager(); return SourceManager.isInMainFile( - SourceManager.getExpansionLoc(Node.getLocStart())); + SourceManager.getExpansionLoc(Node.getSourceRange().getBegin())); } /// \brief Matches AST nodes that were expanded within system-header-files. @@ -261,11 +263,14 @@ /// class Y {}; /// \endcode /// -/// Usable as: Matcher, Matcher, Matcher +/// Usable as: Matcher, Matcher, Matcher, +/// Matcher AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader, - AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) { + AST_POLYMORPHIC_SUPPORTED_TYPES( + Decl, Stmt, TypeLoc, NestedNameSpecifierLoc)) { auto &SourceManager = Finder->getASTContext().getSourceManager(); - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); + auto ExpansionLoc = + SourceManager.getExpansionLoc(Node.getSourceRange().getBegin()); if (ExpansionLoc.isInvalid()) { return false; } @@ -286,12 +291,15 @@ /// class Y {}; /// \endcode /// -/// Usable as: Matcher, Matcher, Matcher +/// Usable as: Matcher, Matcher, Matcher, +/// Matcher AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching, - AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), + AST_POLYMORPHIC_SUPPORTED_TYPES( + Decl, Stmt, TypeLoc, NestedNameSpecifierLoc), std::string, RegExp) { auto &SourceManager = Finder->getASTContext().getSourceManager(); - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); + auto ExpansionLoc = + SourceManager.getExpansionLoc(Node.getSourceRange().getBegin()); if (ExpansionLoc.isInvalid()) { return false; }