aboutsummaryrefslogtreecommitdiff
path: root/include/clang/ASTMatchers
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-10-29 13:47:56 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-10-29 13:47:56 +0000
commit67c63cb9f6cb94fcc7ad47cc8a827ed243adab44 (patch)
tree7f6f23f7844dddb14244100eb267b99f716a271e /include/clang/ASTMatchers
parentec426d1675196956d30e556601c5878ef5b04f63 (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.h14
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.
///