diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-22 19:44:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-22 19:44:59 +0000 |
commit | cce54aa6a40e4c39b25532336e17ce40f0a7e087 (patch) | |
tree | c322fc6207f1cd5194e766e978768fd239b524bc /lib/Serialization | |
parent | 567003e572eed69cf1e8a04601076c8803355c7a (diff) |
If we end up merging an Objective-C class with an existing Objective-C
class that comes from a different module file, make sure that we load
all of the pending declarations for the original declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 93ba34bec6..2c8e6ea466 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -643,10 +643,13 @@ void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) { } void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { + // Record the declaration -> global ID mapping. + Reader.DeclToID[ID] = ThisDeclID; + RedeclarableResult Redecl = VisitRedeclarable(ID); VisitObjCContainerDecl(ID); TypeIDForTypeDecl = Reader.getGlobalTypeID(F, Record[Idx++]); - + // Determine whether we need to merge this declaration with another @interface // with the same name. // FIXME: Not needed unless the module file graph is a DAG. @@ -660,6 +663,18 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { // appropriate canonical declaration. ID->RedeclLink = ObjCInterfaceDecl::PreviousDeclLink(ExistingCanon); + // Don't introduce IDCanon into the set of pending declaration chains. + Redecl.suppress(); + + // Introduce ExistingCanon into the set of pending declaration chains, + // if in fact it came from a module file. + if (ExistingCanon->isFromASTFile()) { + GlobalDeclID ExistingCanonID = Reader.DeclToID[ExistingCanon]; + assert(ExistingCanonID && "Unrecorded canonical declaration ID?"); + if (Reader.PendingDeclChainsKnown.insert(ExistingCanonID)) + Reader.PendingDeclChains.push_back(ExistingCanonID); + } + // If this declaration was the canonical declaration, make a note of // that. if (IDCanon == ID) @@ -2192,7 +2207,6 @@ void ASTReader::loadPendingDeclChain(serialization::GlobalDeclID ID) { if (Chains.empty()) return; - // Capture all of the parsed declarations and put them at the end. Decl *MostRecent = getMostRecentDecl(CanonDecl); Decl *FirstParsed = MostRecent; |