diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2016-08-17 13:10:42 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2016-08-17 13:10:42 +0000 |
commit | 301bc621b5f774ca2998f9804730ee5d15846c8a (patch) | |
tree | 886fd4a09ae3d51d8159a4371b50ca7553b9b636 /include/clang/ASTMatchers | |
parent | 0fc13f413b301f30a33772d9220e7222a5f43d79 (diff) |
Add an AST matcher for external formal linkage.
Patch by Visoiu Mistrih
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/ASTMatchers')
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 6f194e2a57..63ec2a4a94 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -5476,6 +5476,30 @@ AST_MATCHER_P(Stmt, forFunction, internal::Matcher<FunctionDecl>, return false; } +/// \brief Matches a declaration that has external formal linkage. +/// +/// Example matches only z (matcher = varDecl(hasExternalFormalLinkage())) +/// \code +/// void f() { +/// int x; +/// static int y; +/// } +/// int z; +/// \endcode +/// +/// Example matches f() because it has external formal linkage despite being +/// unique to the translation unit as though it has internal likage +/// (matcher = functionDecl(hasExternalFormalLinkage())) +/// +/// \code +/// namespace { +/// void f() {} +/// } +/// \endcode +AST_MATCHER(NamedDecl, hasExternalFormalLinkage) { + return Node.hasExternalFormalLinkage(); +} + } // end namespace ast_matchers } // end namespace clang |