diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-16 02:02:14 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-16 02:02:14 +0000 |
commit | c874ca1c7378d62aff008d74cf744636730f2db4 (patch) | |
tree | 6b3d9887c775146528ca3731758854a295404625 | |
parent | 348ab1ae81a1be6ab3978449b14a426205140b22 (diff) |
Fix the RecursiveASTVisitor to not traverse C++ default parameters twice.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150651 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 4 | ||||
-rw-r--r-- | test/Index/index-refs.cpp | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index a113a94846..a0f4950a04 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1663,7 +1663,9 @@ DEF_TRAVERSE_DECL(CXXDestructorDecl, { template<typename Derived> bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *D) { TRY_TO(TraverseDeclaratorHelper(D)); - TRY_TO(TraverseStmt(D->getInit())); + // Default params are taken care of when we traverse the ParmVarDecl. + if (!isa<ParmVarDecl>(D)) + TRY_TO(TraverseStmt(D->getInit())); return true; } diff --git a/test/Index/index-refs.cpp b/test/Index/index-refs.cpp index fa4b4b3a09..56afa08ec8 100644 --- a/test/Index/index-refs.cpp +++ b/test/Index/index-refs.cpp @@ -107,3 +107,4 @@ void foo4(int p = default_param); // CHECK: [indexEntityReference]: kind: variable | name: array_size | {{.*}} | loc: 59:22 // CHECK: [indexEntityReference]: kind: variable | name: default_param | {{.*}} | loc: 62:19 +// CHECK-NOT: [indexEntityReference]: kind: variable | name: default_param | {{.*}} | loc: 62:19 |