diff options
author | Malcolm Parsons <malcolm.parsons@gmail.com> | 2016-10-26 20:39:54 +0000 |
---|---|---|
committer | Malcolm Parsons <malcolm.parsons@gmail.com> | 2016-10-26 20:39:54 +0000 |
commit | 9bd85d22869e9db54e57031bc2101448943fd5ef (patch) | |
tree | f8aa098195b203a6d190a1690f465c3eaf51daf0 /clang/unittests/Tooling/RecursiveASTVisitorTest.cpp | |
parent | a8bf71cc4e435967938e8a6063335343f0f30072 (diff) | |
download | bcm5719-llvm-9bd85d22869e9db54e57031bc2101448943fd5ef.tar.gz bcm5719-llvm-9bd85d22869e9db54e57031bc2101448943fd5ef.zip |
[RecursiveASTVisitor] Visit the implicit expression of a CXXDefaultArgExpr
Summary:
The matcher
varDecl(hasDescendant(
callExpr(hasDeclaration(functionDecl(unless(isNoThrow()))))))
didn't match calls from default arguments because the expression
for a CXXDefaultArgExpr was not visited.
Reviewers: klimek, jdennett, alexfh, aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Differential Revision: https://reviews.llvm.org/D25992
llvm-svn: 285239
Diffstat (limited to 'clang/unittests/Tooling/RecursiveASTVisitorTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/RecursiveASTVisitorTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp index 991ae8bb7f3..a2aedb64859 100644 --- a/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp +++ b/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp @@ -152,4 +152,21 @@ TEST(RecursiveASTVisitor, ArrayInitializersAreVisited) { "};\n")); } +// Check to ensure that implicit default argument expressions are visited. +class IntegerLiteralVisitor + : public ExpectedLocationVisitor<IntegerLiteralVisitor> { +public: + bool VisitIntegerLiteral(const IntegerLiteral *IL) { + Match("literal", IL->getLocation()); + return true; + } +}; + +TEST(RecursiveASTVisitor, DefaultArgumentsAreVisited) { + IntegerLiteralVisitor Visitor; + Visitor.ExpectMatch("literal", 1, 15, 2); + EXPECT_TRUE(Visitor.runOver("int f(int i = 1);\n" + "static int k = f();\n")); +} + } // end anonymous namespace |