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/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);