[PATCH] Inherit dll attributes to static locals

Hans Wennborg hans at chromium.org
Fri Jun 13 14:32:09 PDT 2014


Thanks for the review!

> It would be nice to have similar tests for the Itanium ABI, but I suspect that you are less interested in that.

As Nico pointed out, they don't seem to export the static locals :/

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1429
@@ -1430,1 +1428,3 @@
+    // Create the guard variable with a zero-initializer.  Just absorb linkage,
+    // visibility and dll storage clsas from the guarded variable.
     GI->Guard =
----------------
Nico Rieck wrote:
> Saleem Abdulrasool wrote:
> > clsas -> class.
> "class"
Done.

================
Comment at: lib/Sema/SemaDecl.cpp:9112
@@ +9111,3 @@
+            dyn_cast<FunctionDecl>(VD->getParentFunctionOrMethod())) {
+      Attr *A = FD->getAttr<DLLImportAttr>();
+      if (!A)
----------------
Nico Rieck wrote:
> There's already a getDLLAttr() function somewhere, but I guess it's not available here. Maybe this helper could be moved to SemaInternal.h?
Sounds good to me.

================
Comment at: test/CodeGenCXX/dllexport.cpp:257
@@ -256,1 +256,3 @@
 
+//===----------------------------------------------------------------------===//
+// Static locals
----------------
Nico Rieck wrote:
> These tests should be at the end of the section for globals (like in SemaCXX/dllexport.cpp) IMO. Same goes for the dllimport tests.
Done.

================
Comment at: test/CodeGenCXX/dllexport.cpp:262
@@ +261,3 @@
+int f();
+// M32-DAG: @"\01?x@?0??nonInlineStaticLocalsFunc@@YAHXZ at 4HA" = internal {{(unnamed_addr )*}}global i32 0
+// M32-DAG: @"\01?$S1@?0??nonInlineStaticLocalsFunc@@YAHXZ at 4IA" = internal {{(unnamed_addr )*}}global i32 0
----------------
Nico Rieck wrote:
> These checks can be MSC-DAG.
Done.

================
Comment at: test/CodeGenCXX/dllexport.cpp:267
@@ +266,3 @@
+  return x++;
+};
+
----------------
Nico Rieck wrote:
> Superfluous ";"
Removed.

================
Comment at: test/CodeGenCXX/dllexport.cpp:269
@@ +268,3 @@
+
+// M32-DAG: @"\01?x@?1??inlineStaticLocalsFunc@@YAHXZ at 4HA" = weak_odr dllexport global i32 0
+// M32-DAG: @"\01??_B?1??inlineStaticLocalsFunc@@YAHXZ at 51" = weak_odr dllexport global i32 0
----------------
Nico Rieck wrote:
> These checks can be MSC-DAG, and please add a comment that MinGW doesn't do this and is not just forgotten here (at least my tests with GCC show this to be true).
Done.

http://reviews.llvm.org/D4136






More information about the cfe-commits mailing list