r253481 - Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 18 11:07:52 PST 2015
Hi Aaron,
There's one test failing now:
https://smooshbase.apple.com/ci/job/apple-clang-stage1-configure-R_master_check/7042/
FAIL: Clang-Unit ::
ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration
(8227 of 24324)
******************** TEST 'Clang-Unit ::
ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration'
FAILED ********************
Note: Google Test filter = Matcher.VarDecl_StorageDuration
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Matcher
[ RUN ] Matcher.VarDecl_StorageDuration
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1362:
Failure
Value of: matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1364:
Failure
Value of: notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1366:
Failure
Value of: notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1368:
Failure
Value of: notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1370:
Failure
Value of: matches(T, varDecl(hasName("y"), hasStaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1371:
Failure
Value of: matches(T, varDecl(hasName("a"), hasStaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1372:
Failure
Value of: notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1373:
Failure
Value of: notMatches(T, varDecl(hasName("z"), hasStaticStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1375:
Failure
Value of: matches(T, varDecl(hasName("z"), hasThreadStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1376:
Failure
Value of: notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1377:
Failure
Value of: notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1 at 2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1378:
Failure
Value of: notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration()))
Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
[ FAILED ] Matcher.VarDecl_StorageDuration (36 ms)
[----------] 1 test from Matcher (36 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (36 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] Matcher.VarDecl_StorageDuration
1 FAILED TEST
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
^
1 error generated.
********************
On Wed, Nov 18, 2015 at 9:56 AM, Aaron Ballman via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: aaronballman
> Date: Wed Nov 18 11:56:55 2015
> New Revision: 253481
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253481&view=rev
> Log:
> Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.
>
> Modified:
> cfe/trunk/docs/LibASTMatchersReference.html
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>
> Modified: cfe/trunk/docs/LibASTMatchersReference.html
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253481&r1=253480&r2=253481&view=diff
> ==============================================================================
> --- cfe/trunk/docs/LibASTMatchersReference.html (original)
> +++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:56:55 2015
> @@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
> </pre></td></tr>
>
>
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isCopyAssignmentOperator0')"><a name="isCopyAssignmentOperator0Anchor">isCopyAssignmentOperator</a></td><td></td></tr>
> +<tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
> +operator.
> +
> +Given
> +struct A {
> + A &operator=(const A &);
> + A &operator=(A &&);
> +};
> +
> +cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
> +the second one.
> +</pre></td></tr>
> +
> +
> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isFinal1')"><a name="isFinal1Anchor">isFinal</a></td><td></td></tr>
> <tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
>
> @@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
> </pre></td></tr>
>
>
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasAutomaticStorageDuration0')"><a name="hasAutomaticStorageDuration0Anchor">hasAutomaticStorageDuration</a></td><td></td></tr>
> +<tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
> +
> +Example matches x, but not y, z, or a.
> +(matcher = varDecl(hasAutomaticStorageDuration())
> +void f() {
> + int x;
> + static int y;
> + thread_local int z;
> +}
> +int a;
> +</pre></td></tr>
> +
> +
> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasGlobalStorage0')"><a name="hasGlobalStorage0Anchor">hasGlobalStorage</a></td><td></td></tr>
> <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
>
> @@ -2774,6 +2803,34 @@ int z;
> </pre></td></tr>
>
>
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasStaticStorageDuration0')"><a name="hasStaticStorageDuration0Anchor">hasStaticStorageDuration</a></td><td></td></tr>
> +<tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
> +
> +Example matches y and a, but not x or z.
> +(matcher = varDecl(hasStaticStorageDuration())
> +void f() {
> + int x;
> + static int y;
> + thread_local int z;
> +}
> +int a;
> +</pre></td></tr>
> +
> +
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasThreadStorageDuration0')"><a name="hasThreadStorageDuration0Anchor">hasThreadStorageDuration</a></td><td></td></tr>
> +<tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
> +
> +Example matches z, but not x, z, or a.
> +(matcher = varDecl(hasThreadStorageDuration())
> +void f() {
> + int x;
> + static int y;
> + thread_local int z;
> +}
> +int a;
> +</pre></td></tr>
> +
> +
> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isConstexpr0')"><a name="isConstexpr0Anchor">isConstexpr</a></td><td></td></tr>
> <tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations.
>
> @@ -3040,6 +3097,22 @@ arraySubscriptExpression(hasIndex(intege
> </pre></td></tr>
>
>
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>></td><td class="name" onclick="toggle('hasLHS1')"><a name="hasLHS1Anchor">hasLHS</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="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
> +
> +Example matches a (matcher = binaryOperator(hasLHS()))
> + a || b
> +</pre></td></tr>
> +
> +
> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>></td><td class="name" onclick="toggle('hasRHS1')"><a name="hasRHS1Anchor">hasRHS</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="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
> +
> +Example matches b (matcher = binaryOperator(hasRHS()))
> + a || b
> +</pre></td></tr>
> +
> +
> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayTypeLoc.html">ArrayTypeLoc</a>></td><td class="name" onclick="toggle('hasElementTypeLoc0')"><a name="hasElementTypeLoc0Anchor">hasElementTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr>
> <tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
> type.
>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=253481&r1=253480&r2=253481&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Nov 18 11:56:55 2015
> @@ -2544,6 +2544,54 @@ AST_MATCHER(VarDecl, hasGlobalStorage) {
> return Node.hasGlobalStorage();
> }
>
> +/// \brief Matches a variable declaration that has automatic storage duration.
> +///
> +/// Example matches x, but not y, z, or a.
> +/// (matcher = varDecl(hasAutomaticStorageDuration())
> +/// \code
> +/// void f() {
> +/// int x;
> +/// static int y;
> +/// thread_local int z;
> +/// }
> +/// int a;
> +/// \endcode
> +AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
> + return Node.getStorageDuration() == SD_Automatic;
> +}
> +
> +/// \brief Matches a variable declaration that has static storage duration.
> +///
> +/// Example matches y and a, but not x or z.
> +/// (matcher = varDecl(hasStaticStorageDuration())
> +/// \code
> +/// void f() {
> +/// int x;
> +/// static int y;
> +/// thread_local int z;
> +/// }
> +/// int a;
> +/// \endcode
> +AST_MATCHER(VarDecl, hasStaticStorageDuration) {
> + return Node.getStorageDuration() == SD_Static;
> +}
> +
> +/// \brief Matches a variable declaration that has thread storage duration.
> +///
> +/// Example matches z, but not x, z, or a.
> +/// (matcher = varDecl(hasThreadStorageDuration())
> +/// \code
> +/// void f() {
> +/// int x;
> +/// static int y;
> +/// thread_local int z;
> +/// }
> +/// int a;
> +/// \endcode
> +AST_MATCHER(VarDecl, hasThreadStorageDuration) {
> + return Node.getStorageDuration() == SD_Thread;
> +}
> +
> /// \brief Matches a variable declaration that is an exception variable from
> /// a C++ catch block, or an Objective-C \@catch statement.
> ///
>
> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=253481&r1=253480&r2=253481&view=diff
> ==============================================================================
> --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Nov 18 11:56:55 2015
> @@ -194,6 +194,7 @@ RegistryMaps::RegistryMaps() {
> REGISTER_MATCHER(hasArgument);
> REGISTER_MATCHER(hasArgumentOfType);
> REGISTER_MATCHER(hasAttr);
> + REGISTER_MATCHER(hasAutomaticStorageDuration);
> REGISTER_MATCHER(hasBase);
> REGISTER_MATCHER(hasBody);
> REGISTER_MATCHER(hasCanonicalType);
> @@ -238,9 +239,11 @@ RegistryMaps::RegistryMaps() {
> REGISTER_MATCHER(hasSize);
> REGISTER_MATCHER(hasSizeExpr);
> REGISTER_MATCHER(hasSourceExpression);
> + REGISTER_MATCHER(hasStaticStorageDuration);
> REGISTER_MATCHER(hasTargetDecl);
> REGISTER_MATCHER(hasTemplateArgument);
> REGISTER_MATCHER(hasThen);
> + REGISTER_MATCHER(hasThreadStorageDuration);
> REGISTER_MATCHER(hasTrueExpression);
> REGISTER_MATCHER(hasTypeLoc);
> REGISTER_MATCHER(hasUnaryOperand);
>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=253481&r1=253480&r2=253481&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Nov 18 11:56:55 2015
> @@ -1355,6 +1355,29 @@ TEST(Matcher, VarDecl_Storage) {
> EXPECT_TRUE(matches("void f() { static int X; }", M));
> }
>
> +TEST(Matcher, VarDecl_StorageDuration) {
> + std::string T =
> + "void f() { int x; static int y; thread_local int z; } int a;";
> +
> + EXPECT_TRUE(matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration())));
> + EXPECT_TRUE(
> + notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration())));
> + EXPECT_TRUE(
> + notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration())));
> + EXPECT_TRUE(
> + notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration())));
> +
> + EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration())));
> + EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration())));
> + EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration())));
> + EXPECT_TRUE(notMatches(T, varDecl(hasName("z"), hasStaticStorageDuration())));
> +
> + EXPECT_TRUE(matches(T, varDecl(hasName("z"), hasThreadStorageDuration())));
> + EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration())));
> + EXPECT_TRUE(notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration())));
> + EXPECT_TRUE(notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration())));
> +}
> +
> TEST(Matcher, FindsVarDeclInFunctionParameter) {
> EXPECT_TRUE(matches(
> "void f(int i) {}",
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
--
Bruno Cardoso Lopes
http://www.brunocardoso.cc
More information about the cfe-commits
mailing list