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

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Wed Feb 12 14:38:20 PST 2014


  The final LGTM should probably wait for a C++ expert, but I agree this would be really nice to have :-)


================
Comment at: test/CodeGenCXX/constexpr-available-externally.cpp:36
@@ +35,3 @@
+
+template struct tpl<int>;
+
----------------
Could you also add a testcase with a explicit template instantiation declaration?

Please also add a test showing we don't emit a available_externally for a member if just the class is used:

class foo {
  static const int X = 1;
  void bar();
}
void f(foo *x) {x->bar(); }

LGTM with that.


================
Comment at: test/CodeGenCXX/constexpr-available-externally.cpp:5
@@ +4,3 @@
+// CHECK: @_ZN6Object3fooE = available_externally constant %struct.Literal { i32 1 }
+// CHECK: @_ZN6Object3barE = available_externally constant i32 42
+// CHECK: @_ZN3tplIiE4nposE = available_externally constant i32 -1
----------------
Can you move this closer to the code that causes it to be output? Maybe with CHECK-DAG?


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



More information about the cfe-commits mailing list