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

via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 07:41:12 PDT 2024


https://github.com/zmodem commented:

> In commit https://github.com/llvm/llvm-project/commit/0a20f5417c9d241f4774a49da6c7ca8123686671, "Better codegen support for DLL attributes being dropped after the first declaration (PR20792)", code was added to enable "dropping" of DLL attributes.

Wow, how is that 10 years ago already?

I'm not sure this is the right place for the fix though. Note that even though my patch added handling for dropping dllexport, we still do export `f` in this case:

```
__declspec(dllexport) int f(int x);
int user(int x) {
  return f(x);
}
int f(int x) { return 1; }
```

Because `f` is still dllexport at the AST level, as it should. That's handled by the code which deals with redeclarations.

I suspect that's where we should fix your case also: we should figure out why `s::f<true>()` isn't(?) marked dllexport in the AST.

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


More information about the cfe-commits mailing list