summaryrefslogtreecommitdiffstats
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-15 18:08:05 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-15 18:08:05 +0000
commitcc32b44ea4b3c702bf84eae0af27ca160bd90831 (patch)
tree163825ac172ff1fd1325edc8ba9f5321ff9bb3c4 /lib/Serialization/ASTWriter.cpp
parent2171bf1caba4d4b9eeb6a91efac4300b41f38b07 (diff)
When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration for that entity, and then propagate that definition pointer from the canonical declaration to all other deserialized declarations. This approach works well even when deserializing declarations that didn't know about the original definition, which can occur with modules. A nice bonus from this definition-deserialization approach is that we no longer need update records when a definition is added, because the redeclaration chains ensure that the if any declaration is loaded, the definition will also get loaded. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index d49e7110c3..20420d6ddc 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -3519,12 +3519,9 @@ void ASTWriter::ResolveDeclUpdatesBlocks() {
unsigned Idx = 0, N = URec.size();
while (Idx < N) {
switch ((DeclUpdateKind)URec[Idx++]) {
- case UPD_CXX_SET_DEFINITIONDATA:
case UPD_CXX_ADDED_IMPLICIT_MEMBER:
case UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION:
case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE:
- case UPD_OBJC_SET_CLASS_DEFINITIONDATA:
- case UPD_OBJC_SET_PROTOCOL_DEFINITIONDATA:
URec[Idx] = GetDeclRef(reinterpret_cast<Decl *>(URec[Idx]));
++Idx;
break;
@@ -4365,22 +4362,6 @@ void ASTWriter::CompletedTagDefinition(const TagDecl *D) {
// have created a new definition decl instead ?
RewriteDecl(RD);
}
-
- for (CXXRecordDecl::redecl_iterator
- I = RD->redecls_begin(), E = RD->redecls_end(); I != E; ++I) {
- CXXRecordDecl *Redecl = cast<CXXRecordDecl>(*I);
- if (Redecl == RD)
- continue;
-
- // We are interested when a PCH decl is modified.
- if (Redecl->isFromASTFile()) {
- UpdateRecord &Record = DeclUpdates[Redecl];
- Record.push_back(UPD_CXX_SET_DEFINITIONDATA);
- assert(Redecl->DefinitionData);
- assert(Redecl->DefinitionData->Definition == D);
- Record.push_back(reinterpret_cast<uint64_t>(D)); // the DefinitionDecl
- }
- }
}
}
void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) {
@@ -4474,45 +4455,6 @@ void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
LocalChainedObjCCategories.push_back(Data);
}
-void ASTWriter::CompletedObjCForwardRef(const ObjCContainerDecl *D) {
- assert(!WritingAST && "Already writing the AST!");
-
- if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) {
- for (ObjCInterfaceDecl::redecl_iterator I = ID->redecls_begin(),
- E = ID->redecls_end();
- I != E; ++I) {
- if (*I == ID)
- continue;
-
- // We are interested when a PCH decl is modified.
- if (I->isFromASTFile()) {
- UpdateRecord &Record = DeclUpdates[*I];
- Record.push_back(UPD_OBJC_SET_CLASS_DEFINITIONDATA);
- assert((*I)->hasDefinition());
- assert((*I)->getDefinition() == D);
- Record.push_back(reinterpret_cast<uint64_t>(D)); // the DefinitionDecl
- }
- }
- }
-
- if (const ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) {
- for (ObjCProtocolDecl::redecl_iterator I = PD->redecls_begin(),
- E = PD->redecls_end();
- I != E; ++I) {
- if (*I == PD)
- continue;
-
- // We are interested when a PCH decl is modified.
- if (I->isFromASTFile()) {
- UpdateRecord &Record = DeclUpdates[*I];
- Record.push_back(UPD_OBJC_SET_PROTOCOL_DEFINITIONDATA);
- assert((*I)->hasDefinition());
- assert((*I)->getDefinition() == D);
- Record.push_back(reinterpret_cast<uint64_t>(D)); // the DefinitionDecl
- }
- }
- }
-}
void ASTWriter::AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
const ObjCPropertyDecl *OrigProp,