summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-14 15:13:49 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-14 15:13:49 +0000
commit68444de354987f9816d368a75997d0f79e359f7b (patch)
treea6d61e6fc15c332526b1c4c5e76e73a6422cd3ca /clang/lib/Serialization/ASTReader.cpp
parentf55694af012b490b5bce192651f40778145cb3a7 (diff)
downloadbcm5719-llvm-68444de354987f9816d368a75997d0f79e359f7b.tar.gz
bcm5719-llvm-68444de354987f9816d368a75997d0f79e359f7b.zip
Reimplement RedeclarableTemplateDecl in terms of
Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of redeclaration-chain logic both in RedeclarableTemplateDecl and especially in its (de-)serialization. As part of this, eliminate the RedeclarableTemplate<> class template, which was an abstraction that didn't actually save anything. llvm-svn: 148181
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index fa21bf5fdbf..2417845ff73 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -6152,10 +6152,10 @@ void ASTReader::finishPendingActions() {
PendingChainedObjCCategories.clear();
}
- // If we deserialized any C++ or Objective-C class definitions or any
- // Objective-C protocol definitions, make sure that all redeclarations point
- // to the definitions. Note that this can only happen now, after the
- // redeclaration chains have been fully wired.
+ // If we deserialized any C++ or Objective-C class definitions, any
+ // Objective-C protocol definitions, or any redeclarable templates, make sure
+ // that all redeclarations point to the definitions. Note that this can only
+ // happen now, after the redeclaration chains have been fully wired.
for (llvm::SmallPtrSet<Decl *, 4>::iterator D = PendingDefinitions.begin(),
DEnd = PendingDefinitions.end();
D != DEnd; ++D) {
@@ -6177,11 +6177,21 @@ void ASTReader::finishPendingActions() {
continue;
}
- ObjCProtocolDecl *PD = cast<ObjCProtocolDecl>(*D);
- for (ObjCProtocolDecl::redecl_iterator R = PD->redecls_begin(),
- REnd = PD->redecls_end();
+ if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(*D)) {
+ for (ObjCProtocolDecl::redecl_iterator R = PD->redecls_begin(),
+ REnd = PD->redecls_end();
+ R != REnd; ++R)
+ R->Data = PD->Data;
+
+ continue;
+ }
+
+ RedeclarableTemplateDecl *RTD
+ = cast<RedeclarableTemplateDecl>(*D)->getCanonicalDecl();
+ for (RedeclarableTemplateDecl::redecl_iterator R = RTD->redecls_begin(),
+ REnd = RTD->redecls_end();
R != REnd; ++R)
- R->Data = PD->Data;
+ R->Common = RTD->Common;
}
PendingDefinitions.clear();
}
OpenPOWER on IntegriCloud