Patch looks good to me. Just one more thing (hopefully...): does this behave
correctly if the global variable lifetime-extends a temporary? Given:
struct Q { int &&r; };
struct S {
static constexpr Q q = { 0 };
};
int k = S::q.r;
... how do we emit `@_ZN1S1qE` and `@_ZGRN1S1qE`?
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1263-1268
@@ +1262,8 @@
+
+bool CodeGenModule::shouldEmitGlobalVariable(const VarDecl *D) {
+ if (canEmitGlobalAsAvailableExternally(D))
+ return CodeGenOpts.OptimizationLevel != 0;
+
+ return true;
+}
+
----------------
Can you find a better name for this function? It returns `true` for variables
that we shouldn't emit at all, which makes me uneasy. Maybe just inline it into
its only call site (which already has a comment describing exactly what this
code does)?
http://llvm-reviews.chandlerc.com/D1982
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits