<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 19, 2019 at 1:30 AM Erik Pilkington via libcxx-commits <<a href="mailto:libcxx-commits@lists.llvm.org">libcxx-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: epilk<br>
Date: Tue Jun 18 16:34:09 2019<br>
New Revision: 363752<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=363752&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=363752&view=rev</a><br>
Log:<br>
[demangle] Special case clang's creative mangling of __uuidof expressions.<br>
<br>
Modified:<br>
libcxxabi/trunk/src/demangle/ItaniumDemangle.h<br>
libcxxabi/trunk/test/test_demangle.pass.cpp<br>
<br>
Modified: libcxxabi/trunk/src/demangle/ItaniumDemangle.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/ItaniumDemangle.h?rev=363752&r1=363751&r2=363752&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/ItaniumDemangle.h?rev=363752&r1=363751&r2=363752&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/src/demangle/ItaniumDemangle.h (original)<br>
+++ libcxxabi/trunk/src/demangle/ItaniumDemangle.h Tue Jun 18 16:34:09 2019<br>
@@ -89,6 +89,7 @@<br>
X(InitListExpr) \<br>
X(FoldExpr) \<br>
X(ThrowExpr) \<br>
+ X(UUIDOfExpr) \<br>
X(BoolExpr) \<br>
X(IntegerCastExpr) \<br>
X(IntegerLiteral) \<br>
@@ -1873,6 +1874,21 @@ public:<br>
}<br>
};<br>
<br>
+// MSVC __uuidof extension, generated by clang in -fms-extensions mode.<br>
+class UUIDOfExpr : public Node {<br>
+ Node *Operand;<br>
+public:<br>
+ UUIDOfExpr(Node *Operand_) : Node(KUUIDOfExpr), Operand(Operand_) {}<br>
+<br>
+ template<typename Fn> void match(Fn F) const { F(Operand); }<br>
+<br>
+ void printLeft(OutputStream &S) const override {<br>
+ S << "__uuidof(";<br>
+ Operand->print(S);<br>
+ S << ")";<br>
+ }<br>
+};<br>
+<br>
class BoolExpr : public Node {<br>
bool Value;<br>
<br>
@@ -4649,6 +4665,21 @@ Node *AbstractManglingParser<Derived, Al<br>
case '9':<br>
return getDerived().parseUnresolvedName();<br>
}<br>
+<br>
+ if (consumeIf("u8__uuidoft")) {<br>
+ Node *Ty = getDerived().parseType();<br>
+ if (!Ty)<br>
+ return nullptr;<br>
+ return make<UUIDOfExpr>(Ty);<br>
+ }<br>
+<br>
+ if (consumeIf("u8__uuidofz")) {<br>
+ Node *Ex = getDerived().parseExpr();<br>
+ if (!Ex)<br>
+ return nullptr;<br>
+ return make<UUIDOfExpr>(Ex);<br>
+ }<br>
+<br>
return nullptr;<br>
}<br>
<br>
<br>
Modified: libcxxabi/trunk/test/test_demangle.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=363752&r1=363751&r2=363752&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=363752&r1=363751&r2=363752&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/test/test_demangle.pass.cpp (original)<br>
+++ libcxxabi/trunk/test/test_demangle.pass.cpp Tue Jun 18 16:34:09 2019<br>
@@ -29769,6 +29769,9 @@ const char* cases[][2] =<br>
<br>
// Vendor extension types are substitution candidates.<br>
{"_Z1fu3fooS_", "f(foo, foo)"},<br>
+<br>
+ {"_ZN3FooIXu8__uuidofzdeL_Z3sucEEEC1Ev", "Foo<__uuidof(*(suc))>::Foo()"},<br>
+ {"_ZN3FooIXu8__uuidoft13SomeUUIDClassEEC1Ev", "Foo<__uuidof(SomeUUIDClass)>::Foo()"},<br>
};<br>
<br>
const unsigned N = sizeof(cases) / sizeof(cases[0]);<br>
<br>
<br>
_______________________________________________<br>
libcxx-commits mailing list<br>
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a><br>
</blockquote></div>