forked from OSchip/llvm-project
[demangle] Special case clang's creative mangling of __uuidof expressions.
llvm-svn: 363752
This commit is contained in:
parent
1933cbe866
commit
cf8c6cfcdc
|
@ -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, Alloc>::parseExpr() {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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, Alloc>::parseExpr() {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue