}
void CodeGenModule::EmitTargetMetadata() {
- // 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);
+ for (auto &I : MangledDeclNames) {
+ const Decl *D = I.first.getDecl()->getMostRecentDecl();
+ llvm::GlobalValue *GV = GetGlobalValue(I.second);
getTargetCodeGenInfo().emitTargetMD(D, GV, *this);
}
}
for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I)
Builder->EmitTopLevelDecl(*I);
- // Emit any deferred inline method definitions. Note that more deferred
- // methods may be added during this loop.
- while (!DeferredInlineMethodDefinitions.empty()) {
- CXXMethodDecl *MD = DeferredInlineMethodDefinitions.back();
- DeferredInlineMethodDefinitions.pop_back();
+ // Emit any deferred inline method definitions.
+ for (CXXMethodDecl *MD : DeferredInlineMethodDefinitions)
Builder->EmitTopLevelDecl(MD);
- }
+ DeferredInlineMethodDefinitions.clear();
return true;
}