summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 1e5401d9bf3..d7f5b722df3 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -3667,6 +3667,14 @@ TEST(ExceptionHandling, SimpleCases) {
varDecl(isExceptionVariable())));
}
+TEST(ParenExpression, SimpleCases) {
+ EXPECT_TRUE(matches("int i = (3);", parenExpr()));
+ EXPECT_TRUE(matches("int i = (3 + 7);", parenExpr()));
+ EXPECT_TRUE(notMatches("int i = 3;", parenExpr()));
+ EXPECT_TRUE(notMatches("int foo() { return 1; }; int a = foo();",
+ parenExpr()));
+}
+
TEST(HasConditionVariableStatement, DoesNotMatchCondition) {
EXPECT_TRUE(notMatches(
"void x() { if(true) {} }",
OpenPOWER on IntegriCloud