[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 Aug 16 10:36:48 PDT 2023


rnk added a comment.

> That doesn't handle the second of your test cases though, where dllimport is put on the member directly:
> ...
> It's not clear to me how we'd want to handle that. I don't think it comes up in libc++, and I can't think of any code that would want to do that either, really.

I think this does actually matter for libc++, I think I have seen this pattern:

  template <typename T>
  struct Foo {
    _LIBCPP_FUNC_VIS _LIBCPP_EXCLUDE_FROM_ABI void method() { }
  };

I can't find an instance right now, though. I think it comes up when you want to have a default visibility function, and also keep it out of the libc++ DSO interface.

This is a somewhat weird and contradictory case, though, the attributes directly conflict. I think it would be reasonable to teach SemaDeclAttr to ignore the dllimport attribute if the other attribute is already present.


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