[PATCH] CodeGen: Emit globals with a constant initializer but no definition as available_externally.

Benjamin Kramer benny.kra at gmail.com
Thu Feb 20 04:39:37 PST 2014



================
Comment at: lib/CodeGen/CodeGenModule.cpp:1908-1909
@@ +1907,4 @@
+  if (D->hasInit() && !D->hasDefinition(Context)) {
+    assert(isTypeConstant(D->getType(), /*ExcludeCtor=*/true) &&
+           "Variable to be emitted as available externally must be constant!");
+    return llvm::GlobalValue::AvailableExternallyLinkage;
----------------
Richard Smith wrote:
> Why is this an assert rather than a test?
The idea was that this code path could never be triggered if the check failed earlier. But that's obsolete with the latest update.


http://llvm-reviews.chandlerc.com/D1982



More information about the cfe-commits mailing list