aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
authorJonas Toth <jonas.toth@gmail.com>2018-11-09 20:54:06 +0000
committerJonas Toth <jonas.toth@gmail.com>2018-11-09 20:54:06 +0000
commit295aa09dd2288525f85cc2defb06f940c5405c87 (patch)
treee5c9f4d1a8074472a5fd29854a7a3f3753e17470 /clang/unittests
parenta1050973ed12ad9486f9f0c59729f3889ee776c0 (diff)
[ASTMatchers] overload ignoringParens for Expr
Summary: This patch allows fixing PR39583. Reviewers: aaron.ballman, sbenza, klimek Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D54307 llvm-svn: 346554
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index 55f9a9ab695d..9278987cb0b6 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1147,6 +1147,14 @@ TEST(ParenExpression, SimpleCases) {
parenExpr()));
}
+TEST(ParenExpression, IgnoringParens) {
+ EXPECT_FALSE(matches("const char* str = (\"my-string\");",
+ implicitCastExpr(hasSourceExpression(stringLiteral()))));
+ EXPECT_TRUE(matches(
+ "const char* str = (\"my-string\");",
+ implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))));
+}
+
TEST(TypeMatching, MatchesTypes) {
EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
}