diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h --- a/llvm/include/llvm/Support/ScopedPrinter.h +++ b/llvm/include/llvm/Support/ScopedPrinter.h @@ -682,7 +682,7 @@ void printFlagsImpl(StringRef Label, HexNumber Value, ArrayRef Flags) override { JOS.attributeObject(Label, [&]() { - JOS.attribute("RawFlags", hexNumberToInt(Value)); + JOS.attribute("Value", hexNumberToInt(Value)); JOS.attributeArray("Flags", [&]() { for (const FlagEntry &Flag : Flags) { JOS.objectBegin(); @@ -697,7 +697,7 @@ void printFlagsImpl(StringRef Label, HexNumber Value, ArrayRef Flags) override { JOS.attributeObject(Label, [&]() { - JOS.attribute("RawFlags", hexNumberToInt(Value)); + JOS.attribute("Value", hexNumberToInt(Value)); JOS.attributeArray("Flags", [&]() { for (const HexNumber &Flag : Flags) { JOS.value(Flag.Value); @@ -728,8 +728,8 @@ void printHexImpl(StringRef Label, StringRef Str, HexNumber Value) override { JOS.attributeObject(Label, [&]() { - JOS.attribute("Value", Str); - JOS.attribute("RawValue", hexNumberToInt(Value)); + JOS.attribute("Name", Str); + JOS.attribute("Value", hexNumberToInt(Value)); }); } @@ -744,8 +744,8 @@ void printNumberImpl(StringRef Label, StringRef Str, StringRef Value) override { JOS.attributeObject(Label, [&]() { - JOS.attribute("Value", Str); - JOS.attributeBegin("RawValue"); + JOS.attribute("Name", Str); + JOS.attributeBegin("Value"); JOS.rawValueBegin() << Value; JOS.rawValueEnd(); JOS.attributeEnd(); diff --git a/llvm/test/tools/llvm-readobj/ELF/llvm-vs-json-format.test b/llvm/test/tools/llvm-readobj/ELF/llvm-vs-json-format.test --- a/llvm/test/tools/llvm-readobj/ELF/llvm-vs-json-format.test +++ b/llvm/test/tools/llvm-readobj/ELF/llvm-vs-json-format.test @@ -7,30 +7,30 @@ # RUN: llvm-readobj --symbols %t.o | FileCheck %s --check-prefix=LLVM # RUN: llvm-readobj --symbols --pretty-print --elf-output-style=JSON %t.o | FileCheck %s --check-prefix=JSON -# LLVM: Name: foo -# LLVM: Other [ (0x80) +# LLVM: Name: foo +# LLVM: Other [ (0x80) # LLVM-NEXT: STO_AARCH64_VARIANT_PCS (0x80) # LLVM-NEXT: ] -# LLVM: Name: bar -# LLVM: Other: 0 +# LLVM: Name: bar +# LLVM: Other: 0 -# JSON: "Value": "foo", -# JSON: "Other": { -# JSON-NEXT: "RawFlags": 128, -# JSON-NEXT: "Flags": [ -# JSON-NEXT: { -# JSON-NEXT: "Name": "STO_AARCH64_VARIANT_PCS", -# JSON-NEXT: "Value": 128 -# JSON-NEXT: } -# JSON-NEXT: ] -# JSON-NEXT: }, +# JSON: "Name": "foo", +# JSON: "Other": { +# JSON-NEXT: "Value": 128, +# JSON-NEXT: "Flags": [ +# JSON-NEXT: { +# JSON-NEXT: "Name": "STO_AARCH64_VARIANT_PCS", +# JSON-NEXT: "Value": 128 +# JSON-NEXT: } +# JSON-NEXT: ] +# JSON-NEXT: }, -# JSON: "Name": { -# JSON-NEXT: "Value": "bar", -# JSON: "Other": { -# JSON-NEXT: "RawFlags": 0, -# JSON-NEXT: "Flags": [] -# JSON-NEXT: }, +# JSON: "Name": { +# JSON-NEXT: "Name": "bar", +# JSON: "Other": { +# JSON-NEXT: "Value": 0, +# JSON-NEXT: "Flags": [] +# JSON-NEXT: }, --- !ELF FileHeader: @@ -74,12 +74,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 0, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_NONE", -# JSON-64-NEXT: "RawValue": 0 +# JSON-64-NEXT: "Name": "R_X86_64_NONE", +# JSON-64-NEXT: "Value": 0 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rel_0", -# JSON-64-NEXT: "RawValue": 1 +# JSON-64-NEXT: "Name": "rel_0", +# JSON-64-NEXT: "Value": 1 # JSON-64-NEXT: } # JSON-64-NEXT: } # JSON-64-NEXT: }, @@ -87,12 +87,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 1, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_PC32", -# JSON-64-NEXT: "RawValue": 2 +# JSON-64-NEXT: "Name": "R_X86_64_PC32", +# JSON-64-NEXT: "Value": 2 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rel_neg", -# JSON-64-NEXT: "RawValue": 2 +# JSON-64-NEXT: "Name": "rel_neg", +# JSON-64-NEXT: "Value": 2 # JSON-64-NEXT: } # JSON-64-NEXT: } # JSON-64-NEXT: }, @@ -100,12 +100,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 5, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_PLT32", -# JSON-64-NEXT: "RawValue": 4 +# JSON-64-NEXT: "Name": "R_X86_64_PLT32", +# JSON-64-NEXT: "Value": 4 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rel_pos", -# JSON-64-NEXT: "RawValue": 3 +# JSON-64-NEXT: "Name": "rel_pos", +# JSON-64-NEXT: "Value": 3 # JSON-64-NEXT: } # JSON-64-NEXT: } # JSON-64-NEXT: }, @@ -113,12 +113,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 9, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_64", -# JSON-64-NEXT: "RawValue": 1 +# JSON-64-NEXT: "Name": "R_X86_64_64", +# JSON-64-NEXT: "Value": 1 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rel_64", -# JSON-64-NEXT: "RawValue": 4 +# JSON-64-NEXT: "Name": "rel_64", +# JSON-64-NEXT: "Value": 4 # JSON-64-NEXT: } # JSON-64-NEXT: } # JSON-64-NEXT: }} @@ -128,12 +128,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 0, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_NONE", -# JSON-64-NEXT: "RawValue": 0 +# JSON-64-NEXT: "Name": "R_X86_64_NONE", +# JSON-64-NEXT: "Value": 0 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rela_0", -# JSON-64-NEXT: "RawValue": 5 +# JSON-64-NEXT: "Name": "rela_0", +# JSON-64-NEXT: "Value": 5 # JSON-64-NEXT: }, # JSON-64-NEXT: "Addend": 0 # JSON-64-NEXT: } @@ -142,12 +142,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 1, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_PC32", -# JSON-64-NEXT: "RawValue": 2 +# JSON-64-NEXT: "Name": "R_X86_64_PC32", +# JSON-64-NEXT: "Value": 2 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rela_neg", -# JSON-64-NEXT: "RawValue": 6 +# JSON-64-NEXT: "Name": "rela_neg", +# JSON-64-NEXT: "Value": 6 # JSON-64-NEXT: }, # JSON-64-NEXT: "Addend": 18446744073709551615 # JSON-64-NEXT: } @@ -156,12 +156,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 5, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_PLT32", -# JSON-64-NEXT: "RawValue": 4 +# JSON-64-NEXT: "Name": "R_X86_64_PLT32", +# JSON-64-NEXT: "Value": 4 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rela_pos", -# JSON-64-NEXT: "RawValue": 7 +# JSON-64-NEXT: "Name": "rela_pos", +# JSON-64-NEXT: "Value": 7 # JSON-64-NEXT: }, # JSON-64-NEXT: "Addend": 2 # JSON-64-NEXT: } @@ -170,12 +170,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 18446744073709551615, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_64", -# JSON-64-NEXT: "RawValue": 1 +# JSON-64-NEXT: "Name": "R_X86_64_64", +# JSON-64-NEXT: "Value": 1 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rela_minneg", -# JSON-64-NEXT: "RawValue": 8 +# JSON-64-NEXT: "Name": "rela_minneg", +# JSON-64-NEXT: "Value": 8 # JSON-64-NEXT: }, # JSON-64-NEXT: "Addend": 9223372036854775808 # JSON-64-NEXT: } @@ -184,12 +184,12 @@ # JSON-64-NEXT: "Relocation": { # JSON-64-NEXT: "Offset": 9, # JSON-64-NEXT: "Type": { -# JSON-64-NEXT: "Value": "R_X86_64_32S", -# JSON-64-NEXT: "RawValue": 11 +# JSON-64-NEXT: "Name": "R_X86_64_32S", +# JSON-64-NEXT: "Value": 11 # JSON-64-NEXT: }, # JSON-64-NEXT: "Symbol": { -# JSON-64-NEXT: "Value": "rela_maxpos", -# JSON-64-NEXT: "RawValue": 9 +# JSON-64-NEXT: "Name": "rela_maxpos", +# JSON-64-NEXT: "Value": 9 # JSON-64-NEXT: }, # JSON-64-NEXT: "Addend": 9223372036854775807 # JSON-64-NEXT: } diff --git a/llvm/unittests/Support/ScopedPrinterTest.cpp b/llvm/unittests/Support/ScopedPrinterTest.cpp --- a/llvm/unittests/Support/ScopedPrinterTest.cpp +++ b/llvm/unittests/Support/ScopedPrinterTest.cpp @@ -236,8 +236,8 @@ const char *JSONExpectedOut = R"({ "Exists": { - "Value": "Name2", - "RawValue": 2 + "Name": "Name2", + "Value": 2 }, "DoesNotExist": 5 })"; @@ -348,15 +348,15 @@ const char *JSONExpectedOut = R"({ "ZeroFlag": { - "RawFlags": 0, + "Value": 0, "Flags": [] }, "NoFlag": { - "RawFlags": 8, + "Value": 8, "Flags": [] }, "Flag1": { - "RawFlags": 1, + "Value": 1, "Flags": [ { "Name": "Name1", @@ -365,7 +365,7 @@ ] }, "Flag1&3": { - "RawFlags": 5, + "Value": 5, "Flags": [ { "Name": "Name1", @@ -378,30 +378,30 @@ ] }, "ZeroFlagRaw": { - "RawFlags": 0, + "Value": 0, "Flags": [] }, "NoFlagRaw": { - "RawFlags": 8, + "Value": 8, "Flags": [ 8 ] }, "Flag1Raw": { - "RawFlags": 1, + "Value": 1, "Flags": [ 1 ] }, "Flag1&3Raw": { - "RawFlags": 5, + "Value": 5, "Flags": [ 1, 4 ] }, "FlagSorted": { - "RawFlags": 7, + "Value": 7, "Flags": [ { "Name": "A", @@ -418,7 +418,7 @@ ] }, "NoBitMask": { - "RawFlags": 4095, + "Value": 4095, "Flags": [ { "Name": "FirstByte1", @@ -459,7 +459,7 @@ ] }, "FirstByteMask": { - "RawFlags": 3, + "Value": 3, "Flags": [ { "Name": "FirstByte3", @@ -468,7 +468,7 @@ ] }, "SecondByteMask": { - "RawFlags": 48, + "Value": 48, "Flags": [ { "Name": "SecondByte3", @@ -477,7 +477,7 @@ ] }, "ValueOutsideMask": { - "RawFlags": 1, + "Value": 1, "Flags": [ { "Name": "FirstByte1", @@ -486,11 +486,11 @@ ] }, "FirstSecondByteMask": { - "RawFlags": 255, + "Value": 255, "Flags": [] }, "FirstSecondThirdByteMask": { - "RawFlags": 819, + "Value": 819, "Flags": [ { "Name": "FirstByte3", @@ -597,8 +597,8 @@ "int8_t-min": -128, "apsint": 9999999999999999999999, "label": { - "Value": "value", - "RawValue": 0 + "Name": "value", + "Value": 0 } })"; verifyAll(ExpectedOut, JSONExpectedOut, PrintFunc); @@ -764,8 +764,8 @@ const char *JSONExpectedOut = R"({ "HexNumber": 16, "HexLabel": { - "Value": "Name", - "RawValue": 16 + "Name": "Name", + "Value": 16 } })"; verifyAll(ExpectedOut, JSONExpectedOut, PrintFunc);