[llvm-branch-commits] [cfe-branch] r115278 - /cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
Daniel Dunbar
daniel at zuster.org
Thu Sep 30 20:42:06 PDT 2010
Author: ddunbar
Date: Thu Sep 30 22:42:06 2010
New Revision: 115278
URL: http://llvm.org/viewvc/llvm-project?rev=115278&view=rev
Log:
Merge r114937:
--
Author: Sebastian Redl <sebastian.redl at getdesigned.at>
Date: Tue Sep 28 02:24:44 2010 +0000
Fix a use of an invalidated reference due to a hash map reallocating.
Modified:
cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp?rev=115278&r1=115277&r2=115278&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp Thu Sep 30 22:42:06 2010
@@ -3180,7 +3180,9 @@
// There might be lexical decls in multiple parts of the chain, for the TU
// at least.
- DeclContextInfos &Infos = DeclContextOffsets[DC];
+ // DeclContextOffsets might reallocate as we load additional decls below,
+ // so make a copy of the vector.
+ DeclContextInfos Infos = DeclContextOffsets[DC];
for (DeclContextInfos::iterator I = Infos.begin(), E = Infos.end();
I != E; ++I) {
// IDs can be 0 if this context doesn't contain declarations.
@@ -3190,8 +3192,11 @@
// Load all of the declaration IDs
for (const DeclID *ID = I->LexicalDecls,
*IDE = ID + I->NumLexicalDecls;
- ID != IDE; ++ID)
- Decls.push_back(GetDecl(*ID));
+ ID != IDE; ++ID) {
+ Decl *D = GetDecl(*ID);
+ assert(D && "Null decl in lexical decls");
+ Decls.push_back(D);
+ }
}
++NumLexicalDeclContextsRead;
More information about the llvm-branch-commits
mailing list