diff options
author | Malcolm Parsons <malcolm.parsons@gmail.com> | 2016-12-24 13:35:14 +0000 |
---|---|---|
committer | Malcolm Parsons <malcolm.parsons@gmail.com> | 2016-12-24 13:35:14 +0000 |
commit | 4ca3d18b96bd75b5af4a6ebd8a57c673c8867344 (patch) | |
tree | 1a32b65b6a732768186679d1eef3c958aaecd285 /clang/docs/LibASTMatchersReference.html | |
parent | 81e48b26bc274f86ec302c1435edf6421b9a101d (diff) | |
download | bcm5719-llvm-4ca3d18b96bd75b5af4a6ebd8a57c673c8867344.tar.gz bcm5719-llvm-4ca3d18b96bd75b5af4a6ebd8a57c673c8867344.zip |
[ASTMatchers] Add hasInClassInitializer traversal matcher for FieldDecl.
Summary:
I needed to know whether a FieldDecl had an in-class
initializer for D26453. I used a narrowing matcher there, but a
traversal matcher might be generally useful.
Reviewers: sbenza, bkramer, klimek, aaron.ballman
Subscribers: aaron.ballman, Prazek, cfe-commits
Differential Revision: https://reviews.llvm.org/D28034
llvm-svn: 290492
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
-rw-r--r-- | clang/docs/LibASTMatchersReference.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 7745480c44c..4ee953f1838 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -4751,6 +4751,22 @@ would only match the declaration for a. </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>></td><td class="name" onclick="toggle('hasInClassInitializer0')"><a name="hasInClassInitializer0Anchor">hasInClassInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> +<tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer. + +Given + class C { + int a = 2; + int b = 3; + int c; + }; +fieldDecl(hasInClassInitializer(integerLiteral(equals(2)))) + matches 'int a;' but not 'int b;'. +fieldDecl(hasInClassInitializer(anything())) + matches 'int a;' and 'int b;' but not 'int c;'. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>></td><td class="name" onclick="toggle('hasBody1')"><a name="hasBody1Anchor">hasBody</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function definition that has a given body. |