[PATCH] D78171: Rework how UuidAttr, CXXUuidofExpr, and GUID template arguments and constants are represented.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 12:39:37 PDT 2020


rsmith marked an inline comment as done.
rsmith added inline comments.


================
Comment at: clang/lib/AST/Decl.cpp:897-898
+    // Fall through.
+    // FIXME: Should GUIDs receive hidden visibility? We give them DSO-local
+    // linkage in CodeGen.
+
----------------
rnk wrote:
> I suppose the answer is yes, it can be hidden. One cannot write a Windows app that expects `&__uuidof(Foo)` to be the same across DSOs. Hopefully we don't have to aim for compatibility to some compiler that targets ELF and supports uuids.
I've not made this change for now. The patch as-is matches our former behavior, and it's far from obvious to me whether
```
template<const GUID&> void f() {}
f<__uuidof(x)>();
```
... should create a template instantiation with hidden visibility. For what it's worth, the variables we create for these `GUID` objects are `dso_local` and `linkonce_odr` but not `hidden`, which seems a little fishy to me. (We expose the symbol to other DSOs but never consume the symbol from other DSOs.) We could probably argue that that's "morally hidden"?

This is certainly easy to change if we think using default visibility is wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78171





More information about the cfe-commits mailing list