[PATCH] D155713: [clang] Fix interaction between dllimport and exclude_from_explicit_instantiation

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 09:49:40 PDT 2023


rnk added a comment.

Thanks for the patch!

The other similar functionality that exists is `/Zc:dllexportInlines-`, which we could track down the implementation of to try to share logic, but I'm not sure about that.

I should defer to @hans for a more thorough code review.



================
Comment at: clang/lib/AST/ASTContext.cpp:11699
   // dllexport/dllimport on inline functions.
-  if (D->hasAttr<DLLImportAttr>()) {
+  if (D->hasAttr<DLLImportAttr>() && !D->hasAttr<ExcludeFromExplicitInstantiationAttr>()) {
     if (L == GVA_DiscardableODR || L == GVA_StrongODR)
----------------
I think this may not be quite right. If it is possible for the EFEI attr to appear on non-template entities with vague linkage, we would still need to import/export them.


================
Comment at: clang/lib/AST/ASTContext.cpp:11702
       return GVA_AvailableExternally;
   } else if (D->hasAttr<DLLExportAttr>()) {
     if (L == GVA_DiscardableODR)
----------------
I wonder if we have to do something on the other side to prevent dllexport from upgrading `linkonce_odr` linkage to `weak_odr` linkage if we later go on to suppress the dllexport storage class.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155713/new/

https://reviews.llvm.org/D155713



More information about the cfe-commits mailing list