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

Erik Pilkington via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 18 16:34:10 PDT 2019


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]);




More information about the libcxx-commits mailing list