Index: cfe/trunk/docs/LibASTMatchersReference.html =================================================================== --- cfe/trunk/docs/LibASTMatchersReference.html +++ cfe/trunk/docs/LibASTMatchersReference.html @@ -2741,19 +2741,22 @@ Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> -
Matches extern "C" function declarations. +- Matches extern "C" function or variable declarations. Given: extern "C" void f() {} extern "C" { void g() {} } void h() {} + extern "C" int x = 1; + extern "C" int y = 2; + int z = 3; functionDecl(isExternC()) - matches the declaration of f and g, but not the declaration h + matches the declaration of f and g, but not the declaration of h. +varDecl(isExternC()) + matches the declaration of x and y, but not the declaration of z.Matcher<FunctionDecl> isInline - Matches function and namespace declarations that are marked with the inline keyword. @@ -3680,19 +3683,22 @@ Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>- Matcher<VarDecl> isExternC Matches extern "C" function declarations. +- Matches extern "C" function or variable declarations. Given: extern "C" void f() {} extern "C" { void g() {} } void h() {} + extern "C" int x = 1; + extern "C" int y = 2; + int z = 3; functionDecl(isExternC()) - matches the declaration of f and g, but not the declaration h + matches the declaration of f and g, but not the declaration of h. +varDecl(isExternC()) + matches the declaration of x and y, but not the declaration of z.Matcher<VarDecl> isStaticStorageClass Matches variablefunction declarations that have "static" storage class specifier ("static" keyword) written in the source. Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h @@ -3533,16 +3533,21 @@ return InnerMatcher.matches(Node.getReturnType(), Finder, Builder); } -/// \brief Matches extern "C" function declarations. +/// \brief Matches extern "C" function or variable declarations. /// /// Given: /// \code /// extern "C" void f() {} /// extern "C" { void g() {} } /// void h() {} +/// extern "C" int x = 1; +/// extern "C" int y = 2; +/// int z = 3; /// \endcode /// functionDecl(isExternC()) -/// matches the declaration of f and g, but not the declaration h +/// matches the declaration of f and g, but not the declaration of h. +/// varDecl(isExternC()) +/// matches the declaration of x and y, but not the declaration of z. AST_POLYMORPHIC_MATCHER(isExternC, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl)) { return Node.isExternC();