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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 14:36:15 PST 2018


rsmith added a comment.

Do we need to also track whether the argument is a pointer or reference to a UUID (and also the cv-qualifiers)? For the `Declaration` case, we track this by tracking the corresponding parameter type; the same thing would presumably work here.

In https://reviews.llvm.org/D43576#1016295, @majnemer wrote:

> We should really, really avoid making this sort of change without first trying to desugar uuidof into a reference to a variable. That would solve a ton of problems, problems like this one.


This desugaring approach is not how we generally do things in Clang. The fact that MS exposes a variable that can be named from user code is, in my opinion, simply a bug in their implementation -- their implementation details are leaking -- and not part of the actual semantics here. I view this as exactly analogous to `typeid` (which would have exactly the same problems if its result could be used as a non-type template parameter); as with `typeid`, `__uuidof` notionally produces a global object not corresponding to any variable. If we want to model this as a declaration, we could add a new `Decl` subclass for these uuid objects (and eventually also for objects produced by `typeid`). But I don't think we should model them as variables unless that's actually part of their intended semantics.


https://reviews.llvm.org/D43576





More information about the cfe-commits mailing list