diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-16 15:34:14 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-16 15:34:14 +0000 |
commit | 426b5cf16ae97e1cb9c4b459861e35c88908d50e (patch) | |
tree | 21eff07b7d190172bddb71b1e82afc74cbb239af /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 9ac4390bf42fcb0faeda08153912c6990b79cb1a (diff) | |
download | bcm5719-llvm-426b5cf16ae97e1cb9c4b459861e35c88908d50e.tar.gz bcm5719-llvm-426b5cf16ae97e1cb9c4b459861e35c88908d50e.zip |
Ensure that the most recent declaration of a tentative definition wins
when generating a common definition.
llvm-svn: 69287
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 81bff667fb9..d1d67a11b8a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -424,9 +424,11 @@ void CodeGenModule::EmitDeferred() { EmitGlobalDefinition(D); } - // Emit any tentative definitions. - for (std::vector<const VarDecl*>::iterator it = TentativeDefinitions.begin(), - ie = TentativeDefinitions.end(); it != ie; ++it) + // Emit any tentative definitions, in reverse order so the most + // important (merged) decl will be seen and emitted first. + for (std::vector<const VarDecl*>::reverse_iterator + it = TentativeDefinitions.rbegin(), ie = TentativeDefinitions.rend(); + it != ie; ++it) EmitTentativeDefinition(*it); } |