Print out the union field being initialized by an InitListExpr when dumping the AST to JSON.
llvm-svn: 363869
This commit is contained in:
parent
40a156b791
commit
709a769cdd
|
@ -251,6 +251,7 @@ public:
|
|||
void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
|
||||
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
|
||||
void VisitConstantExpr(const ConstantExpr *CE);
|
||||
void VisitInitListExpr(const InitListExpr *ILE);
|
||||
|
||||
void VisitIntegerLiteral(const IntegerLiteral *IL);
|
||||
void VisitCharacterLiteral(const CharacterLiteral *CL);
|
||||
|
|
|
@ -984,6 +984,11 @@ void JSONNodeDumper::VisitConstantExpr(const ConstantExpr *CE) {
|
|||
}
|
||||
}
|
||||
|
||||
void JSONNodeDumper::VisitInitListExpr(const InitListExpr *ILE) {
|
||||
if (const FieldDecl *FD = ILE->getInitializedFieldInUnion())
|
||||
JOS.attribute("field", createBareDeclRef(FD));
|
||||
}
|
||||
|
||||
void JSONNodeDumper::VisitIntegerLiteral(const IntegerLiteral *IL) {
|
||||
JOS.attribute("value",
|
||||
IL->getValue().toString(
|
||||
|
|
|
@ -2415,7 +2415,15 @@ void TestIteration() {
|
|||
// CHECK-NEXT: "type": {
|
||||
// CHECK-NEXT: "qualType": "U"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "valueCategory": "rvalue"
|
||||
// CHECK-NEXT: "valueCategory": "rvalue",
|
||||
// CHECK-NEXT: "field": {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
// CHECK-NEXT: "kind": "FieldDecl",
|
||||
// CHECK-NEXT: "name": "i",
|
||||
// CHECK-NEXT: "type": {
|
||||
// CHECK-NEXT: "qualType": "int"
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
|
@ -2436,6 +2444,14 @@ void TestIteration() {
|
|||
// CHECK-NEXT: "qualType": "U"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "valueCategory": "rvalue",
|
||||
// CHECK-NEXT: "field": {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
// CHECK-NEXT: "kind": "FieldDecl",
|
||||
// CHECK-NEXT: "name": "i",
|
||||
// CHECK-NEXT: "type": {
|
||||
// CHECK-NEXT: "qualType": "int"
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "inner": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
|
@ -5975,4 +5991,3 @@ void TestIteration() {
|
|||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: }
|
||||
|
||||
|
|
Loading…
Reference in New Issue