From d735a572ccba3602067230d4c7b2f141dace72a0 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 27 May 2019 14:17:32 +0000 Subject: [PATCH] When dumping the AST to JSON, dump the argument name to a sizeof pack expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361766 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/JSONNodeDumper.h | 1 + lib/AST/JSONNodeDumper.cpp | 4 ++++ test/AST/ast-dump-expr-json.cpp | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/clang/AST/JSONNodeDumper.h b/include/clang/AST/JSONNodeDumper.h index b966747f42..dfad90b16d 100644 --- a/include/clang/AST/JSONNodeDumper.h +++ b/include/clang/AST/JSONNodeDumper.h @@ -244,6 +244,7 @@ public: void VisitImplicitCastExpr(const ImplicitCastExpr *ICE); void VisitCallExpr(const CallExpr *CE); void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE); + void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE); void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE); void VisitAddrLabelExpr(const AddrLabelExpr *ALE); diff --git a/lib/AST/JSONNodeDumper.cpp b/lib/AST/JSONNodeDumper.cpp index afe43e436d..a6600c0c84 100644 --- a/lib/AST/JSONNodeDumper.cpp +++ b/lib/AST/JSONNodeDumper.cpp @@ -894,6 +894,10 @@ void JSONNodeDumper::VisitUnaryExprOrTypeTraitExpr( JOS.attribute("argType", createQualType(TTE->getArgumentType())); } +void JSONNodeDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE) { + VisitNamedDecl(SOPE->getPack()); +} + void JSONNodeDumper::VisitUnresolvedLookupExpr( const UnresolvedLookupExpr *ULE) { JOS.attribute("usesADL", ULE->requiresADL()); diff --git a/test/AST/ast-dump-expr-json.cpp b/test/AST/ast-dump-expr-json.cpp index 81c3e66c39..0c541666d2 100644 --- a/test/AST/ast-dump-expr-json.cpp +++ b/test/AST/ast-dump-expr-json.cpp @@ -1505,7 +1505,8 @@ void TestNonADLCall3() { // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "unsigned long" // CHECK-NEXT: }, -// CHECK-NEXT: "valueCategory": "rvalue" +// CHECK-NEXT: "valueCategory": "rvalue", +// CHECK-NEXT: "name": "Ts" // CHECK-NEXT: }, // CHECK-NEXT: { // CHECK-NEXT: "id": "0x{{.*}}", -- 2.40.0