summaryrefslogtreecommitdiffstats
path: root/include/clang/ASTMatchers
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-09-27 07:53:20 +0000
committerHaojian Wu <hokein@google.com>2016-09-27 07:53:20 +0000
commit12b3804145dd455f10efdcbe1bd159232266f905 (patch)
treedcf6b94c0f6ea9043cea4baace0d55eef5f9351d /include/clang/ASTMatchers
parent37a34bf1aa320cc702528fa19beb2ada2a80652f (diff)
[ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration documents.
Reviewers: aaron.ballman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24928 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/ASTMatchers')
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index af4cd47d53..3c001c554e 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -2943,9 +2943,9 @@ AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
}
/// \brief Matches a variable declaration that has static storage duration.
+/// It includes the variable declared at namespace scope and those declared
+/// with "static" and "extern" storage class specifiers.
///
-/// Example matches y and a, but not x or z.
-/// (matcher = varDecl(hasStaticStorageDuration())
/// \code
/// void f() {
/// int x;
@@ -2953,6 +2953,10 @@ AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
/// thread_local int z;
/// }
/// int a;
+/// static int b;
+/// extern int c;
+/// varDecl(hasStaticStorageDuration())
+/// matches the function declaration y, a, b and c.
/// \endcode
AST_MATCHER(VarDecl, hasStaticStorageDuration) {
return Node.getStorageDuration() == SD_Static;
@@ -3388,13 +3392,15 @@ AST_POLYMORPHIC_MATCHER(isExternC, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
return Node.isExternC();
}
-/// \brief Matches variable/function declarations that have static storage class
-/// (with "static" key word) written in the source.
+/// \brief Matches variable/function declarations that have "static" storage
+/// class specifier ("static" keyword) written in the source.
///
/// Given:
/// \code
/// static void f() {}
/// static int i = 0;
+/// extern int j;
+/// int k;
/// \endcode
/// functionDecl(isStaticStorageClass())
/// matches the function declaration f.