[libcxx-commits] [libcxxabi] r363752 - [demangle] Special case clang's creative mangling of __uuidof expressions.

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 22 09:20:53 PDT 2019


Do you know where this mangling got added? The mangling looks a bit
surprising in that if for some reason you have two different type names
with the same uuid, then I would've expected that Foo<__uuidof(T1)> and
Foo<__uuidof(T2)> would produce the same symbol name, like they do in the
MS abi.

On Wed, Jun 19, 2019 at 1:30 AM Erik Pilkington via libcxx-commits <
libcxx-commits at lists.llvm.org> wrote:

> Author: epilk
> Date: Tue Jun 18 16:34:09 2019
> New Revision: 363752
>
> URL: http://llvm.org/viewvc/llvm-project?rev=363752&view=rev
> Log:
> [demangle] Special case clang's creative mangling of __uuidof expressions.
>
> Modified:
>     libcxxabi/trunk/src/demangle/ItaniumDemangle.h
>     libcxxabi/trunk/test/test_demangle.pass.cpp
>
> Modified: libcxxabi/trunk/src/demangle/ItaniumDemangle.h
> URL:
> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/ItaniumDemangle.h?rev=363752&r1=363751&r2=363752&view=diff
>
> ==============================================================================
> --- libcxxabi/trunk/src/demangle/ItaniumDemangle.h (original)
> +++ libcxxabi/trunk/src/demangle/ItaniumDemangle.h Tue Jun 18 16:34:09 2019
> @@ -89,6 +89,7 @@
>      X(InitListExpr) \
>      X(FoldExpr) \
>      X(ThrowExpr) \
> +    X(UUIDOfExpr) \
>      X(BoolExpr) \
>      X(IntegerCastExpr) \
>      X(IntegerLiteral) \
> @@ -1873,6 +1874,21 @@ public:
>    }
>  };
>
> +// MSVC __uuidof extension, generated by clang in -fms-extensions mode.
> +class UUIDOfExpr : public Node {
> +  Node *Operand;
> +public:
> +  UUIDOfExpr(Node *Operand_) : Node(KUUIDOfExpr), Operand(Operand_) {}
> +
> +  template<typename Fn> void match(Fn F) const { F(Operand); }
> +
> +  void printLeft(OutputStream &S) const override {
> +    S << "__uuidof(";
> +    Operand->print(S);
> +    S << ")";
> +  }
> +};
> +
>  class BoolExpr : public Node {
>    bool Value;
>
> @@ -4649,6 +4665,21 @@ Node *AbstractManglingParser<Derived, Al
>    case '9':
>      return getDerived().parseUnresolvedName();
>    }
> +
> +  if (consumeIf("u8__uuidoft")) {
> +    Node *Ty = getDerived().parseType();
> +    if (!Ty)
> +      return nullptr;
> +    return make<UUIDOfExpr>(Ty);
> +  }
> +
> +  if (consumeIf("u8__uuidofz")) {
> +    Node *Ex = getDerived().parseExpr();
> +    if (!Ex)
> +      return nullptr;
> +    return make<UUIDOfExpr>(Ex);
> +  }
> +
>    return nullptr;
>  }
>
>
> Modified: libcxxabi/trunk/test/test_demangle.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=363752&r1=363751&r2=363752&view=diff
>
> ==============================================================================
> --- libcxxabi/trunk/test/test_demangle.pass.cpp (original)
> +++ libcxxabi/trunk/test/test_demangle.pass.cpp Tue Jun 18 16:34:09 2019
> @@ -29769,6 +29769,9 @@ const char* cases[][2] =
>
>      // Vendor extension types are substitution candidates.
>      {"_Z1fu3fooS_", "f(foo, foo)"},
> +
> +    {"_ZN3FooIXu8__uuidofzdeL_Z3sucEEEC1Ev",
> "Foo<__uuidof(*(suc))>::Foo()"},
> +    {"_ZN3FooIXu8__uuidoft13SomeUUIDClassEEC1Ev",
> "Foo<__uuidof(SomeUUIDClass)>::Foo()"},
>  };
>
>  const unsigned N = sizeof(cases) / sizeof(cases[0]);
>
>
> _______________________________________________
> libcxx-commits mailing list
> libcxx-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190622/4deaec4e/attachment.html>


More information about the libcxx-commits mailing list