[PATCH] Don't perform init-order checking for globals with no user-defined constructors.
Richard Smith
richard at metafoo.co.uk
Tue Apr 2 15:29:40 PDT 2013
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1823
@@ +1822,3 @@
+ const CXXConstructorDecl *CD = E->getConstructor();
+ IsTrivialDefaultCtor = (CD->isTrivial() && CD->isDefaultConstructor());
+ }
----------------
This should never happen -- NeedsGlobalCtor should be false if the initialization is trivial. If not, we should fix EmitConstantInit to handle this case.
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1816
@@ -1819,3 +1815,3 @@
// If we are compiling with ASan, add metadata indicating dynamically
- // initialized globals.
+ // initialized globals. Do this before we emit initializer function.
if (SanOpts.Address && NeedsGlobalCtor) {
----------------
Why does this need to be before we emit the initializer?
http://llvm-reviews.chandlerc.com/D608
More information about the cfe-commits
mailing list