[PATCH] Allow dllimport/dllexport on inline functions and get the linkage right

Reid Kleckner rnk at google.com
Wed May 14 15:53:39 PDT 2014


================
Comment at: lib/CodeGen/CodeGenModule.cpp:1967
@@ +1966,3 @@
+  if (D->hasAttr<DLLExportAttr>()) {
+    DiscardableODRLinkage = llvm::GlobalVariable::WeakODRLinkage;
+    NonDiscardableODRLinkage = llvm::GlobalVariable::WeakODRLinkage;
----------------
So, this is weird.  We're saying that for discardable things, we need to use a linkage that prohibits discarding them.

Maybe it would be better to change the GVA linkage of dllexported things?

================
Comment at: test/CodeGen/dllexport.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -x c++ -O2 -disable-llvm-optzns -emit-llvm < %s | FileCheck %s
+
----------------
This should be in test/CodeGenCXX

================
Comment at: test/CodeGen/dllexport.cpp:21
@@ +20,3 @@
+void user() {
+  // FIXME: dllexported functions must be emitted even if they're not referenced in this TU.
+  a();
----------------
Sure, it seems fine to split this out as a separate change.

================
Comment at: test/CodeGen/dllimport.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -x c++ -O2 -disable-llvm-optzns -emit-llvm < %s | FileCheck %s
+
----------------
This should be in test/CodeGenCXX

http://reviews.llvm.org/D3772






More information about the cfe-commits mailing list