diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-08-01 19:59:14 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-08-01 19:59:14 +0000 |
| commit | cf08ff50dd35e1a75d3237b2e297683922a9518d (patch) | |
| tree | 99b5e317d9f49578765669d7c5db84dc616e03a8 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 1f52b3da0af421d117b5ec50c0be7e75e4301b37 (diff) | |
Fix iterator invalidation issues that are breaking my modules buildbot's bootstrap.
llvm-svn: 214547
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a14558f975aa..55d47060ff93 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3305,9 +3305,16 @@ void CodeGenModule::EmitVersionIdentMetadata() { } void CodeGenModule::EmitTargetMetadata() { - for (auto &I : MangledDeclNames) { - const Decl *D = I.first.getDecl()->getMostRecentDecl(); - llvm::GlobalValue *GV = GetGlobalValue(I.second); + // Warning, new MangledDeclNames may be appended within this loop. + // We rely on MapVector insertions adding new elements to the end + // of the container. + // FIXME: Move this loop into the one target that needs it, and only + // loop over those declarations for which we couldn't emit the target + // metadata when we emitted the declaration. + for (unsigned I = 0; I != MangledDeclNames.size(); ++I) { + auto &Val = *(MangledDeclNames.begin() + I); + const Decl *D = Val.first.getDecl()->getMostRecentDecl(); + llvm::GlobalValue *GV = GetGlobalValue(Val.second); getTargetCodeGenInfo().emitTargetMD(D, GV, *this); } } |
