Skip to content

Commit e85a09f

Browse files
author
epilk
committed
[demangle] Special case clang's creative mangling of __uuidof expressions.
git-svn-id: http://llvm.org/svn/llvm-project/libcxxabi/trunk@363752 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 56cf804 commit e85a09f

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/demangle/ItaniumDemangle.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
X(InitListExpr) \
9090
X(FoldExpr) \
9191
X(ThrowExpr) \
92+
X(UUIDOfExpr) \
9293
X(BoolExpr) \
9394
X(IntegerCastExpr) \
9495
X(IntegerLiteral) \
@@ -1873,6 +1874,21 @@ class ThrowExpr : public Node {
18731874
}
18741875
};
18751876

1877+
// MSVC __uuidof extension, generated by clang in -fms-extensions mode.
1878+
class UUIDOfExpr : public Node {
1879+
Node *Operand;
1880+
public:
1881+
UUIDOfExpr(Node *Operand_) : Node(KUUIDOfExpr), Operand(Operand_) {}
1882+
1883+
template<typename Fn> void match(Fn F) const { F(Operand); }
1884+
1885+
void printLeft(OutputStream &S) const override {
1886+
S << "__uuidof(";
1887+
Operand->print(S);
1888+
S << ")";
1889+
}
1890+
};
1891+
18761892
class BoolExpr : public Node {
18771893
bool Value;
18781894

@@ -4649,6 +4665,21 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
46494665
case '9':
46504666
return getDerived().parseUnresolvedName();
46514667
}
4668+
4669+
if (consumeIf("u8__uuidoft")) {
4670+
Node *Ty = getDerived().parseType();
4671+
if (!Ty)
4672+
return nullptr;
4673+
return make<UUIDOfExpr>(Ty);
4674+
}
4675+
4676+
if (consumeIf("u8__uuidofz")) {
4677+
Node *Ex = getDerived().parseExpr();
4678+
if (!Ex)
4679+
return nullptr;
4680+
return make<UUIDOfExpr>(Ex);
4681+
}
4682+
46524683
return nullptr;
46534684
}
46544685

test/test_demangle.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29769,6 +29769,9 @@ const char* cases[][2] =
2976929769

2977029770
// Vendor extension types are substitution candidates.
2977129771
{"_Z1fu3fooS_", "f(foo, foo)"},
29772+
29773+
{"_ZN3FooIXu8__uuidofzdeL_Z3sucEEEC1Ev", "Foo<__uuidof(*(suc))>::Foo()"},
29774+
{"_ZN3FooIXu8__uuidoft13SomeUUIDClassEEC1Ev", "Foo<__uuidof(SomeUUIDClass)>::Foo()"},
2977229775
};
2977329776

2977429777
const unsigned N = sizeof(cases) / sizeof(cases[0]);

0 commit comments

Comments
 (0)