[clang] [clang] Fix loss of `dllexport` for exported template specialization (PR #93302)

Paul T Robinson via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 07:30:40 PDT 2024


================
@@ -4554,8 +4554,11 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
         Entry->setLinkage(llvm::Function::ExternalLinkage);
     }
 
-    // Handle dropped DLL attributes.
-    if (D && !D->hasAttr<DLLImportAttr>() && !D->hasAttr<DLLExportAttr>() &&
+    // Handle dropped dllimport.
+    if (D &&
+        (Entry->getDLLStorageClass() ==
+         llvm::GlobalVariable::DLLImportStorageClass) &&
+        !D->hasAttr<DLLImportAttr>() &&
         !shouldMapVisibilityToDLLExport(cast_or_null<NamedDecl>(D))) {
----------------
pogo59 wrote:

```suggestion
        !shouldMapVisibilityToDLLExport(cast<NamedDecl>(D))) {
```
D is non-null here.

https://github.com/llvm/llvm-project/pull/93302


More information about the cfe-commits mailing list