[PATCH] D43576: Solution to fix PR27066 - Redefinition with same mangled name as another definition (dllexport and uuid)

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 15 09:06:13 PDT 2018


zahiraam marked 4 inline comments as done.
zahiraam added inline comments.


================
Comment at: lib/Parse/ParseDecl.cpp:572
+    DeclSpecUuidDecl *ArgDecl =
+      DeclSpecUuidDecl::Create(Actions.getASTContext(),
+                               Actions.getFunctionLevelDeclContext(),
----------------
rsmith wrote:
> What should happen if multiple declarations (of distinct entities) use the same `__declspec(uuid(...))` attribute? Should you get a redefinition error for the attribute or should they all share the same UUID entity? Either way, we'll want to do some (minimal) UUID lookup and build a redeclaration chain for `DeclSpecUuidDecl`s.
If we want to align with MS, we don't want  to signal an error. So may be I should have a map that assigns to each StrUuid a list of DeclSpecUuid?
So for this code:
struct
__declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}"))
S1 {};

struct
__declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}"))
S2 {};

I will have a map from DDB47A6A-0F23-11D5-9109-00E0296B75D3 to {S1, S2}. Do you agree?



================
Comment at: lib/Sema/SemaDeclAttr.cpp:4937-4938
-      return nullptr;
-    Diag(UA->getLocation(), diag::err_mismatched_uuid);
-    Diag(Range.getBegin(), diag::note_previous_uuid);
-    D->dropAttr<UuidAttr>();
----------------
rsmith wrote:
> Do we still diagnose UUID mismatches somewhere else?
Not as far as I know. I guess I should put this diag somewhere?


https://reviews.llvm.org/D43576





More information about the cfe-commits mailing list