diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-16 00:48:59 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-16 00:48:59 +0000 |
commit | 83a6e3bfabb392cfa636d921b19db48ef45b69d0 (patch) | |
tree | 71fe8f6ae96610460251840b60d327763441490a /clang/lib/Serialization/ASTReader.cpp | |
parent | 0062ba649478e2052fa6ef6a141f44cbf208c56e (diff) | |
download | bcm5719-llvm-83a6e3bfabb392cfa636d921b19db48ef45b69d0.tar.gz bcm5719-llvm-83a6e3bfabb392cfa636d921b19db48ef45b69d0.zip |
[PCH] Deserializing the DeclContext of a template parameter is not safe
until recursive loading is finished.
Otherwise we may end up with a template trying to deserialize a template
parameter that is in the process of getting loaded.
rdar://13135282
llvm-svn: 175329
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 6f0dcaae304..ee558dce08d 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -6986,7 +6986,7 @@ void ASTReader::ReadComments() { void ASTReader::finishPendingActions() { while (!PendingIdentifierInfos.empty() || !PendingDeclChains.empty() || - !PendingMacroIDs.empty()) { + !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty()) { // If any identifiers with corresponding top-level declarations have // been loaded, load those declarations now. while (!PendingIdentifierInfos.empty()) { @@ -7013,6 +7013,16 @@ void ASTReader::finishPendingActions() { } } PendingMacroIDs.clear(); + + // Wire up the DeclContexts for Decls that we delayed setting until + // recursive loading is completed. + while (!PendingDeclContextInfos.empty()) { + PendingDeclContextInfo Info = PendingDeclContextInfos.front(); + PendingDeclContextInfos.pop_front(); + DeclContext *SemaDC = cast<DeclContext>(GetDecl(Info.SemaDC)); + DeclContext *LexicalDC = cast<DeclContext>(GetDecl(Info.LexicalDC)); + Info.D->setDeclContextsImpl(SemaDC, LexicalDC, getContext()); + } } // If we deserialized any C++ or Objective-C class definitions, any |