diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-08 18:19:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-08 18:19:27 +0000 |
commit | 0c7973655375698d5eada54f743991c460919e3a (patch) | |
tree | 6bac192b6cd75b459694bfcde4562e8f4ccf634c /clang/lib/Frontend/PCHWriter.cpp | |
parent | 926fc3d68dbbfbd9f80c09616d01f15bd483731d (diff) | |
download | bcm5719-llvm-0c7973655375698d5eada54f743991c460919e3a.tar.gz bcm5719-llvm-0c7973655375698d5eada54f743991c460919e3a.zip |
Fix PR4922, where Sema would complete tentative definitions in nondeterminstic
order because it was doing so while iterating over a densemap.
There are still similar problems in other places, for example
WeakUndeclaredIdentifiers is still written to the PCH file in a nondeterminstic
order, and we emit warnings about #pragma weak in nondeterminstic order.
llvm-svn: 81236
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHWriter.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 985d99abbe4..86a52fcf52c 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -1800,19 +1800,22 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls, getIdentifierRef(&Table.get(BuiltinNames[I])); } - // Build a record containing all of the tentative definitions in - // this header file. Generally, this record will be empty. + // Build a record containing all of the tentative definitions in this file, in + // TentativeDefinitionList order. Generally, this record will be empty for + // headers. RecordData TentativeDefinitions; - for (llvm::DenseMap<DeclarationName, VarDecl *>::iterator - TD = SemaRef.TentativeDefinitions.begin(), - TDEnd = SemaRef.TentativeDefinitions.end(); - TD != TDEnd; ++TD) - AddDeclRef(TD->second, TentativeDefinitions); + for (unsigned i = 0, e = SemaRef.TentativeDefinitionList.size(); i != e; ++i){ + VarDecl *VD = + SemaRef.TentativeDefinitions.lookup(SemaRef.TentativeDefinitionList[i]); + if (VD) AddDeclRef(VD, TentativeDefinitions); + } // Build a record containing all of the locally-scoped external // declarations in this header file. Generally, this record will be // empty. RecordData LocallyScopedExternalDecls; + // FIXME: This is filling in the PCH file in densemap order which is + // nondeterminstic! for (llvm::DenseMap<DeclarationName, NamedDecl *>::iterator TD = SemaRef.LocallyScopedExternalDecls.begin(), TDEnd = SemaRef.LocallyScopedExternalDecls.end(); |