From dfbf171da410f5fb59a20bb37c9efd11f507b3e2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 27 May 2019 14:34:31 +0000 Subject: When dumping the AST to JSON, dump the type information from a typeid expression with a type operand. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361769 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/JSONNodeDumper.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/AST/JSONNodeDumper.cpp') diff --git a/lib/AST/JSONNodeDumper.cpp b/lib/AST/JSONNodeDumper.cpp index 08f63fba98..43cad2bf26 100644 --- a/lib/AST/JSONNodeDumper.cpp +++ b/lib/AST/JSONNodeDumper.cpp @@ -917,6 +917,16 @@ void JSONNodeDumper::VisitAddrLabelExpr(const AddrLabelExpr *ALE) { JOS.attribute("labelDeclId", createPointerRepresentation(ALE->getLabel())); } +void JSONNodeDumper::VisitCXXTypeidExpr(const CXXTypeidExpr *CTE) { + if (CTE->isTypeOperand()) { + QualType Adjusted = CTE->getTypeOperand(Ctx); + QualType Unadjusted = CTE->getTypeOperandSourceInfo()->getType(); + JOS.attribute("typeArg", createQualType(Unadjusted)); + if (Adjusted != Unadjusted) + JOS.attribute("adjustedTypeArg", createQualType(Adjusted)); + } +} + void JSONNodeDumper::VisitIntegerLiteral(const IntegerLiteral *IL) { JOS.attribute("value", IL->getValue().toString( -- cgit v1.2.1