diff options
author | Jonas Toth <jonas.toth@gmail.com> | 2018-07-23 15:59:27 +0000 |
---|---|---|
committer | Jonas Toth <jonas.toth@gmail.com> | 2018-07-23 15:59:27 +0000 |
commit | fbd6d5e462c9daeba44d2c0787265f47575ad5f3 (patch) | |
tree | 6a4134a31209d356d20ecb6cbb6e727b5c442699 /unittests | |
parent | 652c337ae039a437c83a5884f8be76cbc2102113 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersNodeTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/unittests/ASTMatchers/ASTMatchersNodeTest.cpp index fc1a57c488..e521940983 100644 --- a/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ b/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())); |