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

Reid Kleckner rnk at google.com
Thu May 15 12:34:47 PDT 2014


LGTM

================
Comment at: lib/AST/ASTContext.cpp:7778
@@ -7777,1 +7777,3 @@
+  if ((!Context.getLangOpts().CPlusPlus && !Context.getLangOpts().MSVCCompat &&
+       !FD->hasAttr<DLLExportAttr>()) ||
       FD->hasAttr<GNUInlineAttr>()) {
----------------
Reid Kleckner wrote:
> 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.
Based on offline discussion, I'm OK punting on this for now.  It's not like we supported it before.  Please just put a FIXME here that this is ABI incompatible with GCC.

http://reviews.llvm.org/D3772






More information about the cfe-commits mailing list