зеркало из https://github.com/microsoft/clang-1.git
Fix PR12608. Patch contributed by Yang Chen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155355 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d8f0276472
Коммит
9f99d06e0d
|
@ -1567,7 +1567,7 @@ bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(
|
|||
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) {
|
||||
|
|
|
@ -106,6 +106,7 @@ protected:
|
|||
FullLocation.isValid() &&
|
||||
FullLocation.getSpellingLineNumber() == ExpectedLine &&
|
||||
FullLocation.getSpellingColumnNumber() == ExpectedColumn) {
|
||||
EXPECT_TRUE(!Found);
|
||||
Found = true;
|
||||
} else if (Name == ExpectedMatch ||
|
||||
(FullLocation.isValid() &&
|
||||
|
@ -157,6 +158,31 @@ TEST(RecursiveASTVisitor, VisitsBaseClassDeclarations) {
|
|||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче