diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2018-10-29 13:47:56 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2018-10-29 13:47:56 +0000 |
commit | 67c63cb9f6cb94fcc7ad47cc8a827ed243adab44 (patch) | |
tree | 7f6f23f7844dddb14244100eb267b99f716a271e /include/clang/ASTMatchers | |
parent | ec426d1675196956d30e556601c5878ef5b04f63 (diff) |
Add the isStaticLocal() AST matcher for matching on local static variables.
Patch by Joe Ranieri.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/ASTMatchers')
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 3f8690bd8a..6635f25d55 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -3300,6 +3300,20 @@ AST_MATCHER_P( InnerMatcher.matches(*Initializer, Finder, Builder)); } +/// \brief Matches a static variable with local scope. +/// +/// Example matches y (matcher = varDecl(isStaticLocal())) +/// \code +/// void f() { +/// int x; +/// static int y; +/// } +/// static int z; +/// \endcode +AST_MATCHER(VarDecl, isStaticLocal) { + return Node.isStaticLocal(); +} + /// Matches a variable declaration that has function scope and is a /// non-static local variable. /// |