r214555 - Re-commit r214547 with tests fixed. Hopefully all the bots will be happy now.
Richard Smith
richard-llvm at metafoo.co.uk
Fri Aug 1 13:39:37 PDT 2014
Author: rsmith
Date: Fri Aug 1 15:39:36 2014
New Revision: 214555
URL: http://llvm.org/viewvc/llvm-project?rev=214555&view=rev
Log:
Re-commit r214547 with tests fixed. Hopefully all the bots will be happy now.
Original message:
Fix iterator invalidation issues that are breaking my modules buildbot's
bootstrap.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/test/CodeGenCXX/attr-used.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=214555&r1=214554&r2=214555&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Aug 1 15:39:36 2014
@@ -3305,9 +3305,16 @@ void CodeGenModule::EmitVersionIdentMeta
}
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);
}
}
Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=214555&r1=214554&r2=214555&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Fri Aug 1 15:39:36 2014
@@ -94,9 +94,11 @@ namespace {
for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I)
Builder->EmitTopLevelDecl(*I);
- // Emit any deferred inline method definitions.
- for (CXXMethodDecl *MD : DeferredInlineMethodDefinitions)
- Builder->EmitTopLevelDecl(MD);
+ // Emit any deferred inline method definitions. Note that more deferred
+ // methods may be added during this loop, since ASTConsumer callbacks
+ // can be invoked if AST inspection results in declarations being added.
+ for (unsigned I = 0; I != DeferredInlineMethodDefinitions.size(); ++I)
+ Builder->EmitTopLevelDecl(DeferredInlineMethodDefinitions[I]);
DeferredInlineMethodDefinitions.clear();
return true;
Modified: cfe/trunk/test/CodeGenCXX/attr-used.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-used.cpp?rev=214555&r1=214554&r2=214555&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/attr-used.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/attr-used.cpp Fri Aug 1 15:39:36 2014
@@ -2,16 +2,16 @@
// <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors
struct X0 {
- // CHECK: define linkonce_odr {{.*}} @_ZN2X0C1Ev
+ // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0C1Ev
__attribute__((used)) X0() {}
- // CHECK: define linkonce_odr {{.*}} @_ZN2X0D1Ev
+ // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X0D1Ev
__attribute__((used)) ~X0() {}
};
// PR19743: not emitting __attribute__((used)) inline methods in nested classes.
struct X1 {
struct Nested {
- // CHECK: define linkonce_odr {{.*}} @_ZN2X16Nested1fEv
+ // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X16Nested1fEv
void __attribute__((used)) f() {}
};
};
@@ -22,6 +22,6 @@ struct X2 {
void __attribute__((used)) bar() { foo(); }
void foo() { }
- // CHECK: define linkonce_odr {{.*}} @_ZN2X23barEv
- // CHECK: define linkonce_odr {{.*}} @_ZN2X23fooEv
+ // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23barEv
+ // CHECK-DAG: define linkonce_odr {{.*}} @_ZN2X23fooEv
};
More information about the cfe-commits
mailing list