summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
diff options
context:
space:
mode:
authorJonas Toth <jonas.toth@gmail.com>2018-07-23 15:59:27 +0000
committerJonas Toth <jonas.toth@gmail.com>2018-07-23 15:59:27 +0000
commitfa1ea6977c37f4d6ac89907215dfa04b50f7ab8b (patch)
treed926d4d44359ecaf5e817347954c699e94a6def0 /clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
parent4f4dfbacada3f33b00786bda2f13a91ad45d6ba1 (diff)
downloadbcm5719-llvm-fa1ea6977c37f4d6ac89907215dfa04b50f7ab8b.tar.gz
bcm5719-llvm-fa1ea6977c37f4d6ac89907215dfa04b50f7ab8b.zip
[ASTMatchers] add matcher for decltypeType and its underlyingType
Summary: This patch introduces a new matcher for `DecltypeType` and its underlying type in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more. Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48759 llvm-svn: 337703
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index fc1a57c4885..e521940983b 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1206,6 +1206,12 @@ TEST(TypeMatching, MatchesAutoTypes) {
// autoType(hasDeducedType(isInteger()))));
}
+TEST(TypeMatching, MatchesDeclTypes) {
+ EXPECT_TRUE(matches("decltype(1 + 1) sum = 1 + 1;", decltypeType()));
+ EXPECT_TRUE(matches("decltype(1 + 1) sum = 1 + 1;",
+ decltypeType(hasUnderlyingType(isInteger()))));
+}
+
TEST(TypeMatching, MatchesFunctionTypes) {
EXPECT_TRUE(matches("int (*f)(int);", functionType()));
EXPECT_TRUE(matches("void f(int i) {}", functionType()));
OpenPOWER on IntegriCloud