[cfe-commits] r155355 - in /cfe/trunk: include/clang/AST/RecursiveASTVisitor.h unittests/Tooling/RecursiveASTVisitorTest.cpp
Manuel Klimek
klimek at google.com
Mon Apr 23 09:40:40 PDT 2012
Author: klimek
Date: Mon Apr 23 11:40:40 2012
New Revision: 155355
URL: http://llvm.org/viewvc/llvm-project?rev=155355&view=rev
Log:
Fix PR12608. Patch contributed by Yang Chen.
Modified:
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTest.cpp
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=155355&r1=155354&r2=155355&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Apr 23 11:40:40 2012
@@ -1567,7 +1567,7 @@
CXXRecordDecl *D) {
if (!TraverseRecordHelper(D))
return false;
- if (D->hasDefinition()) {
+ if (D->isCompleteDefinition()) {
for (CXXRecordDecl::base_class_iterator I = D->bases_begin(),
E = D->bases_end();
I != E; ++I) {
Modified: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RecursiveASTVisitorTest.cpp?rev=155355&r1=155354&r2=155355&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/RecursiveASTVisitorTest.cpp Mon Apr 23 11:40:40 2012
@@ -106,6 +106,7 @@
FullLocation.isValid() &&
FullLocation.getSpellingLineNumber() == ExpectedLine &&
FullLocation.getSpellingColumnNumber() == ExpectedColumn) {
+ EXPECT_TRUE(!Found);
Found = true;
} else if (Name == ExpectedMatch ||
(FullLocation.isValid() &&
@@ -157,6 +158,31 @@
EXPECT_TRUE(Visitor.runOver("class X {}; class Y : public X {};"));
}
+TEST(RecursiveASTVisitor, VisitsCXXBaseSpecifiersOfForwardDeclaredClass) {
+ TypeLocVisitor Visitor;
+ Visitor.ExpectMatch("class X", 3, 18);
+ EXPECT_TRUE(Visitor.runOver(
+ "class Y;\n"
+ "class X {};\n"
+ "class Y : public X {};"));
+}
+
+TEST(RecursiveASTVisitor, VisitsCXXBaseSpecifiersWithIncompleteInnerClass) {
+ TypeLocVisitor Visitor;
+ Visitor.ExpectMatch("class X", 2, 18);
+ EXPECT_TRUE(Visitor.runOver(
+ "class X {};\n"
+ "class Y : public X { class Z; };"));
+}
+
+TEST(RecursiveASTVisitor, VisitsCXXBaseSpecifiersOfSelfReferentialType) {
+ TypeLocVisitor Visitor;
+ Visitor.ExpectMatch("X<class Y>", 2, 18);
+ EXPECT_TRUE(Visitor.runOver(
+ "template<typename T> class X {};\n"
+ "class Y : public X<Y> {};"));
+}
+
TEST(RecursiveASTVisitor, VisitsBaseClassTemplateArguments) {
DeclRefExprVisitor Visitor;
Visitor.ExpectMatch("x", 2, 3);
More information about the cfe-commits
mailing list