summaryrefslogtreecommitdiffstats
path: root/clang/docs/LibASTMatchersReference.html
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-05-12 04:20:04 +0000
committerEtienne Bergeron <etienneb@google.com>2016-05-12 04:20:04 +0000
commit3588be7fa1d7829179eafd32eb9fb6d19a400ce8 (patch)
tree8dee662bde9f3d3acc5b02838a1ed0cdf074555d /clang/docs/LibASTMatchersReference.html
parent33e694a8077809dc414145d65a31f73068c85589 (diff)
downloadbcm5719-llvm-3588be7fa1d7829179eafd32eb9fb6d19a400ce8.tar.gz
bcm5719-llvm-3588be7fa1d7829179eafd32eb9fb6d19a400ce8.zip
Add an AST matcher for string-literal length
Summary: This patch is adding support for a matcher to check string literal length. This matcher is used in clang-tidy checkers and is part of this refactoring: see: http://reviews.llvm.org/D19841 Reviewers: sbenza, klimek, aaron.ballman Subscribers: alexfh, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19876 llvm-svn: 269274
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
-rw-r--r--clang/docs/LibASTMatchersReference.html33
1 files changed, 29 insertions, 4 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html
index bd0f53f5b1b..2d4b8c19997 100644
--- a/clang/docs/LibASTMatchersReference.html
+++ b/clang/docs/LibASTMatchersReference.html
@@ -644,7 +644,8 @@ Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
though.
Example matches 'a', L'a'
- char ch = 'a'; wchar_t chw = L'a';
+ char ch = 'a';
+ wchar_t chw = L'a';
</pre></td></tr>
@@ -652,7 +653,8 @@ Example matches 'a', L'a'
<tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
Example match: {1}, (1, 2)
- int array[4] = {1}; vector int myvec = (vector int)(1, 2);
+ int array[4] = {1};
+ vector int myvec = (vector int)(1, 2);
</pre></td></tr>
@@ -1217,7 +1219,8 @@ Example match: ({ int X = 4; X; })
<tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
Example matches "abcd", L"abcd"
- char *s = "abcd"; wchar_t *ws = L"abcd"
+ char *s = "abcd";
+ wchar_t *ws = L"abcd";
</pre></td></tr>
@@ -2191,14 +2194,19 @@ compoundStmt(statementCountIs(0)))
<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>&gt;</td><td class="name" onclick="toggle('hasSize0')"><a name="hasSize0Anchor">hasSize</a></td><td>unsigned N</td></tr>
-<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches ConstantArrayType nodes that have the specified size.
+<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
Given
int a[42];
int b[2 * 21];
int c[41], d[43];
+ char *s = "abcd";
+ wchar_t *ws = L"abcd";
+ char *w = "a";
constantArrayType(hasSize(42))
matches "int a[42]" and "int b[2 * 21]"
+stringLiteral(hasSize(4))
+ matches "abcd", L"abcd"
</pre></td></tr>
@@ -2955,6 +2963,23 @@ Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.
</pre></td></tr>
+<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;</td><td class="name" onclick="toggle('hasSize1')"><a name="hasSize1Anchor">hasSize</a></td><td>unsigned N</td></tr>
+<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
+
+Given
+ int a[42];
+ int b[2 * 21];
+ int c[41], d[43];
+ char *s = "abcd";
+ wchar_t *ws = L"abcd";
+ char *w = "a";
+constantArrayType(hasSize(42))
+ matches "int a[42]" and "int b[2 * 21]"
+stringLiteral(hasSize(4))
+ matches "abcd", L"abcd"
+</pre></td></tr>
+
+
<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition0')"><a name="isDefinition0Anchor">isDefinition</a></td><td></td></tr>
<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
OpenPOWER on IntegriCloud