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

Reid Kleckner rnk at google.com
Thu May 15 11:55:24 PDT 2014


================
Comment at: lib/AST/ASTContext.cpp:7778
@@ -7777,1 +7777,3 @@
+  if ((!Context.getLangOpts().CPlusPlus && !Context.getLangOpts().MSVCCompat &&
+       !FD->hasAttr<DLLExportAttr>()) ||
       FD->hasAttr<GNUInlineAttr>()) {
----------------
Sorry to run you around, but I tested and realized this is inconsistent with what GCC does.  GCC seems to treat dllexport similar to extern.  I recall Nico Rieck had a patch titled "Sema: Treat dllimport globals without explicit storage class as extern" that did somethign like this.

GCC emits a strong external definition for this code:
inline __attribute__((dllexport)) void foo() {}

We should do the same.

http://reviews.llvm.org/D3772






More information about the cfe-commits mailing list