diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-14 15:13:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-14 15:13:49 +0000 |
commit | 7c99bb5c4901c39460818ff8c00840218c48251f (patch) | |
tree | 9fbb09a974379415610adfcc29123dd5f8c8e47c /lib/Serialization/ASTReader.cpp | |
parent | 170fd49294b85ab10f820721d99ff9d109c7230d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index fa21bf5fdb..2417845ff7 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/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(); } |