diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-11 23:26:42 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-11 23:26:42 +0000 |
commit | 1d233f9a5e2219df131ebfc33a8978f80fe57960 (patch) | |
tree | 2b72177a45c6306e7cca22d3a27840c0b1b01350 /clang/lib/Serialization/ASTReader.cpp | |
parent | d33c4d39a03d0ec337336ad2d81948c5770b4e4a (diff) | |
download | bcm5719-llvm-1d233f9a5e2219df131ebfc33a8978f80fe57960.tar.gz bcm5719-llvm-1d233f9a5e2219df131ebfc33a8978f80fe57960.zip |
Fix a PCH crash bug where we kept a reference inside a DenseMap while the map was getting modified.
No test case, sorry. It's one of those bugs where it's really really hard to make one. rdar://9910862.
llvm-svn: 137383
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 490e5f9da2a..1bda1ed42a8 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -4307,7 +4307,10 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, // There might be visible decls in multiple parts of the chain, for the TU // and namespaces. For any given name, the last available results replace // all earlier ones. For this reason, we walk in reverse. - DeclContextInfos &Infos = DeclContextOffsets[DC]; + // Copy the DeclContextInfos vector instead of using a reference to the + // vector stored in the map, because DeclContextOffsets can change while + // we load declarations with GetLocalDeclAs. + DeclContextInfos Infos = DeclContextOffsets[DC]; for (DeclContextInfos::reverse_iterator I = Infos.rbegin(), E = Infos.rend(); I != E; ++I) { if (!I->NameLookupTableData) |