diff options
author | John McCall <rjmccall@apple.com> | 2010-06-03 19:28:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-06-03 19:28:45 +0000 |
commit | 5250f27420386452a21692a6292c99ee7febdac4 (patch) | |
tree | 94b044a9f5598be6e138b77c6df915ca522e4e11 /lib/Frontend/PCHReaderDecl.cpp | |
parent | df432e338c68e0e06dd7644c43f3f218750b3d58 (diff) |
Hack in some really terrible C++ record PCH support that I need right now.
This is required in order to test:
The ASTImporter should set base classes after formally entering the definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 2a1044c447..606e852385 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -38,6 +38,8 @@ namespace { unsigned &Idx) : Reader(Reader), Record(Record), Idx(Idx) { } + CXXBaseSpecifier *ReadCXXBaseSpecifier(); + void VisitDecl(Decl *D); void VisitTranslationUnitDecl(TranslationUnitDecl *TU); void VisitNamedDecl(NamedDecl *ND); @@ -550,9 +552,38 @@ void PCHDeclReader::VisitUnresolvedUsingTypename( D->setTargetNestedNameSpecifier(Reader.ReadNestedNameSpecifier(Record, Idx)); } +CXXBaseSpecifier *PCHDeclReader::ReadCXXBaseSpecifier() { + bool isVirtual = static_cast<bool>(Record[Idx++]); + bool isBaseOfClass = static_cast<bool>(Record[Idx++]); + AccessSpecifier AS = static_cast<AccessSpecifier>(Record[Idx++]); + QualType T = Reader.GetType(Record[Idx++]); + SourceRange Range = Reader.ReadSourceRange(Record, Idx); + return new (*Reader.getContext()) + CXXBaseSpecifier(Range, isVirtual, isBaseOfClass, AS, T); +} + void PCHDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) { // assert(false && "cannot read CXXRecordDecl"); VisitRecordDecl(D); + + // FIXME: this is far from complete + + if (D->isDefinition()) { + D->setDefinition(false); // make peace with an assertion + D->startDefinition(); + + unsigned NumBases = Record[Idx++]; + + llvm::SmallVector<CXXBaseSpecifier*, 4> Bases; + Bases.reserve(NumBases); + for (unsigned I = 0; I != NumBases; ++I) + Bases.push_back(ReadCXXBaseSpecifier()); + D->setBases(Bases.begin(), NumBases); + + // FIXME: there's a lot of stuff we do here that's kindof sketchy + // if we're leaving the context incomplete. + D->completeDefinition(); + } } void PCHDeclReader::VisitCXXMethodDecl(CXXMethodDecl *D) { |