Index: llvm/include/llvm/ObjectYAML/DWARFYAML.h =================================================================== --- llvm/include/llvm/ObjectYAML/DWARFYAML.h +++ llvm/include/llvm/ObjectYAML/DWARFYAML.h @@ -161,8 +161,6 @@ } // end namespace DWARFYAML } // end namespace llvm -LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex64) -LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex8) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor) Index: llvm/include/llvm/Support/YAMLTraits.h =================================================================== --- llvm/include/llvm/Support/YAMLTraits.h +++ llvm/include/llvm/Support/YAMLTraits.h @@ -2035,4 +2035,9 @@ } \ } +LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex64) +LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex32) +LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex16) +LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex8) + #endif // LLVM_SUPPORT_YAMLTRAITS_H Index: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml +++ llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml @@ -531,8 +531,7 @@ #CHECK: - Value: 0x0000000100000F50 #CHECK: - Value: 0x0000000000000034 #CHECK: - Value: 0x0000000000000001 -#CHECK: BlockData: -#CHECK: - 0x56 +#CHECK: BlockData: [ 0x56 ] #CHECK: - Value: 0x0000000000000076 #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 @@ -542,9 +541,7 @@ #CHECK: - AbbrCode: 0x00000003 #CHECK: Values: #CHECK: - Value: 0x0000000000000002 -#CHECK: BlockData: -#CHECK: - 0x91 -#CHECK: - 0x78 +#CHECK: BlockData: [ 0x91, 0x78 ] #CHECK: - Value: 0x000000000000007B #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 @@ -552,9 +549,7 @@ #CHECK: - AbbrCode: 0x00000003 #CHECK: Values: #CHECK: - Value: 0x0000000000000002 -#CHECK: BlockData: -#CHECK: - 0x91 -#CHECK: - 0x70 +#CHECK: BlockData: [ 0x91, 0x70 ] #CHECK: - Value: 0x0000000000000080 #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 Index: llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml +++ llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml @@ -438,53 +438,17 @@ #CHECK: Values: #CHECK: - Value: 0x0123456789ABCDEF #CHECK: - Value: 0x000000000000000A -#CHECK: BlockData: -#CHECK: - 0x01 -#CHECK: - 0x02 -#CHECK: - 0x03 -#CHECK: - 0x04 -#CHECK: - 0x05 -#CHECK: - 0x06 -#CHECK: - 0x07 -#CHECK: - 0x08 -#CHECK: - 0x09 -#CHECK: - 0x00 +#CHECK: BlockData: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +#CHECK: 0x08, 0x09, 0x00 ] #CHECK: - Value: 0x000000000000000A -#CHECK: BlockData: -#CHECK: - 0x01 -#CHECK: - 0x02 -#CHECK: - 0x03 -#CHECK: - 0x04 -#CHECK: - 0x05 -#CHECK: - 0x06 -#CHECK: - 0x07 -#CHECK: - 0x08 -#CHECK: - 0x09 -#CHECK: - 0x00 +#CHECK: BlockData: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +#CHECK: 0x08, 0x09, 0x00 ] #CHECK: - Value: 0x000000000000000A -#CHECK: BlockData: -#CHECK: - 0x01 -#CHECK: - 0x02 -#CHECK: - 0x03 -#CHECK: - 0x04 -#CHECK: - 0x05 -#CHECK: - 0x06 -#CHECK: - 0x07 -#CHECK: - 0x08 -#CHECK: - 0x09 -#CHECK: - 0x00 +#CHECK: BlockData: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +#CHECK: 0x08, 0x09, 0x00 ] #CHECK: - Value: 0x000000000000000A -#CHECK: BlockData: -#CHECK: - 0x01 -#CHECK: - 0x02 -#CHECK: - 0x03 -#CHECK: - 0x04 -#CHECK: - 0x05 -#CHECK: - 0x06 -#CHECK: - 0x07 -#CHECK: - 0x08 -#CHECK: - 0x09 -#CHECK: - 0x00 +#CHECK: BlockData: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +#CHECK: 0x08, 0x09, 0x00 ] #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000002345 #CHECK: - Value: 0x000000006789ABCD Index: llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml +++ llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml @@ -532,8 +532,7 @@ #CHECK: - Value: 0x0000000100000F50 #CHECK: - Value: 0x0000000000000034 #CHECK: - Value: 0x0000000000000001 -#CHECK: BlockData: -#CHECK: - 0x56 +#CHECK: BlockData: [ 0x56 ] #CHECK: - Value: 0x0000000000000076 #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 @@ -543,9 +542,7 @@ #CHECK: - AbbrCode: 0x00000003 #CHECK: Values: #CHECK: - Value: 0x0000000000000002 -#CHECK: BlockData: -#CHECK: - 0x91 -#CHECK: - 0x78 +#CHECK: BlockData: [ 0x91, 0x78 ] #CHECK: - Value: 0x000000000000007B #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 @@ -553,9 +550,7 @@ #CHECK: - AbbrCode: 0x00000003 #CHECK: Values: #CHECK: - Value: 0x0000000000000002 -#CHECK: BlockData: -#CHECK: - 0x91 -#CHECK: - 0x70 +#CHECK: BlockData: [ 0x91, 0x70 ] #CHECK: - Value: 0x0000000000000080 #CHECK: - Value: 0x0000000000000001 #CHECK: - Value: 0x0000000000000003 Index: llvm/test/ObjectYAML/MachO/bind_opcode.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/bind_opcode.yaml +++ llvm/test/ObjectYAML/MachO/bind_opcode.yaml @@ -107,8 +107,7 @@ #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000000 +#CHECK: ULEBExtraData: [ 0x0000000000000000 ] #CHECK: - Opcode: BIND_OPCODE_DO_BIND #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM Index: llvm/test/ObjectYAML/MachO/bogus_load_command.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/bogus_load_command.yaml +++ llvm/test/ObjectYAML/MachO/bogus_load_command.yaml @@ -36,17 +36,6 @@ #CHECK: ZeroPadBytes: #CHECK: - cmd: 0xDEADBEEF #CHECK: cmdsize: 24 -#CHECK: PayloadBytes: -#CHECK: - 0x01 -#CHECK: - 0x02 -#CHECK: - 0x03 -#CHECK: - 0x04 -#CHECK: - 0x05 -#CHECK: - 0x06 -#CHECK: - 0x07 -#CHECK: - 0x08 -#CHECK: - 0x09 -#CHECK: - 0x0A -#CHECK: - 0x0B -#CHECK: - 0x0C +#CHECK: PayloadBytes: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, +#CHECK: 0x09, 0x0A, 0x0B, 0x0C, 0x00, 0x00, 0x00, 0x00 ] #CHECK-NOT: LinkEditData: Index: llvm/test/ObjectYAML/MachO/lazy_bind_opcode.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/lazy_bind_opcode.yaml +++ llvm/test/ObjectYAML/MachO/lazy_bind_opcode.yaml @@ -267,8 +267,7 @@ #CHECK: LazyBindOpcodes: #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000028 +#CHECK: ULEBExtraData: [ 0x0000000000000028 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -280,8 +279,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000030 +#CHECK: ULEBExtraData: [ 0x0000000000000030 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -293,8 +291,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000038 +#CHECK: ULEBExtraData: [ 0x0000000000000038 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -306,8 +303,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000040 +#CHECK: ULEBExtraData: [ 0x0000000000000040 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -319,8 +315,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000048 +#CHECK: ULEBExtraData: [ 0x0000000000000048 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -332,8 +327,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000050 +#CHECK: ULEBExtraData: [ 0x0000000000000050 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -345,8 +339,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000058 +#CHECK: ULEBExtraData: [ 0x0000000000000058 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -358,8 +351,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000060 +#CHECK: ULEBExtraData: [ 0x0000000000000060 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -371,8 +363,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000068 +#CHECK: ULEBExtraData: [ 0x0000000000000068 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -384,8 +375,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000070 +#CHECK: ULEBExtraData: [ 0x0000000000000070 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -397,8 +387,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000078 +#CHECK: ULEBExtraData: [ 0x0000000000000078 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -410,8 +399,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000080 +#CHECK: ULEBExtraData: [ 0x0000000000000080 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -423,8 +411,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000088 +#CHECK: ULEBExtraData: [ 0x0000000000000088 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 2 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -436,8 +423,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000090 +#CHECK: ULEBExtraData: [ 0x0000000000000090 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 2 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM @@ -449,8 +435,7 @@ #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000098 +#CHECK: ULEBExtraData: [ 0x0000000000000098 ] #CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM #CHECK: Imm: 2 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM Index: llvm/test/ObjectYAML/MachO/out_of_order_linkedit.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/out_of_order_linkedit.yaml +++ llvm/test/ObjectYAML/MachO/out_of_order_linkedit.yaml @@ -214,12 +214,10 @@ #CHECK: Imm: 1 #CHECK: - Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ExtraData: -#CHECK: - 0x0000000000000028 +#CHECK: ExtraData: [ 0x0000000000000028 ] #CHECK: - Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES #CHECK: Imm: 0 -#CHECK: ExtraData: -#CHECK: - 0x000000000000000F +#CHECK: ExtraData: [ 0x000000000000000F ] #CHECK: - Opcode: REBASE_OPCODE_DONE #CHECK: Imm: 0 #CHECK: BindOpcodes: @@ -234,8 +232,7 @@ #CHECK: Symbol: '' #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000000 +#CHECK: ULEBExtraData: [ 0x0000000000000000 ] #CHECK: Symbol: '' #CHECK: - Opcode: BIND_OPCODE_DO_BIND #CHECK: Imm: 0 Index: llvm/test/ObjectYAML/MachO/rebase_opcode.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/rebase_opcode.yaml +++ llvm/test/ObjectYAML/MachO/rebase_opcode.yaml @@ -82,11 +82,9 @@ #CHECK: Imm: 1 #CHECK: - Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ExtraData: -#CHECK: - 0x0000000000000028 +#CHECK: ExtraData: [ 0x0000000000000028 ] #CHECK: - Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES #CHECK: Imm: 0 -#CHECK: ExtraData: -#CHECK: - 0x000000000000000F +#CHECK: ExtraData: [ 0x000000000000000F ] #CHECK: - Opcode: REBASE_OPCODE_DONE #CHECK: Imm: 0 Index: llvm/test/ObjectYAML/MachO/weak_bind_opcode.yaml =================================================================== --- llvm/test/ObjectYAML/MachO/weak_bind_opcode.yaml +++ llvm/test/ObjectYAML/MachO/weak_bind_opcode.yaml @@ -107,8 +107,7 @@ #CHECK: Imm: 1 #CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB #CHECK: Imm: 2 -#CHECK: ULEBExtraData: -#CHECK: - 0x0000000000000000 +#CHECK: ULEBExtraData: [ 0x0000000000000000 ] #CHECK: - Opcode: BIND_OPCODE_DO_BIND #CHECK: Imm: 0 #CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM Index: llvm/unittests/Support/YAMLIOTest.cpp =================================================================== --- llvm/unittests/Support/YAMLIOTest.cpp +++ llvm/unittests/Support/YAMLIOTest.cpp @@ -2189,7 +2189,6 @@ // // Test error handling reading built-in Hex8 type // -LLVM_YAML_IS_SEQUENCE_VECTOR(Hex8) TEST(YAMLIO, TestReadBuiltInTypesHex8Error) { std::vector seq; Input yin("---\n" @@ -2200,15 +2199,26 @@ /*Ctxt=*/nullptr, suppressErrorMessages); yin >> seq; - EXPECT_TRUE(!!yin.error()); + + std::vector seq2; + Input yin2("---\n" + "[ 0x12, 0xFE, 0x123 ]\n" + "...\n", + /*Ctxt=*/nullptr, suppressErrorMessages); + yin2 >> seq2; + EXPECT_TRUE(!!yin2.error()); + + EXPECT_TRUE(seq.size() == 3); + EXPECT_TRUE(seq.size() == seq2.size()); + for (size_t i = 0; i < seq.size(); ++i) + EXPECT_TRUE(seq[i] == seq2[i]); } // // Test error handling reading built-in Hex16 type // -LLVM_YAML_IS_SEQUENCE_VECTOR(Hex16) TEST(YAMLIO, TestReadBuiltInTypesHex16Error) { std::vector seq; Input yin("---\n" @@ -2219,14 +2229,25 @@ /*Ctxt=*/nullptr, suppressErrorMessages); yin >> seq; - EXPECT_TRUE(!!yin.error()); + + std::vector seq2; + Input yin2("---\n" + "[ 0x0012, 0xFEFF, 0x12345 ]\n" + "...\n", + /*Ctxt=*/nullptr, suppressErrorMessages); + yin2 >> seq2; + EXPECT_TRUE(!!yin2.error()); + + EXPECT_TRUE(seq.size() == 3); + EXPECT_TRUE(seq.size() == seq2.size()); + for (size_t i = 0; i < seq.size(); ++i) + EXPECT_TRUE(seq[i] == seq2[i]); } // // Test error handling reading built-in Hex32 type // -LLVM_YAML_IS_SEQUENCE_VECTOR(Hex32) TEST(YAMLIO, TestReadBuiltInTypesHex32Error) { std::vector seq; Input yin("---\n" @@ -2239,12 +2260,24 @@ yin >> seq; EXPECT_TRUE(!!yin.error()); + + std::vector seq2; + Input yin2("---\n" + "[ 0x0012, 0xFEFF0000, 0x1234556789 ]\n" + "...\n", + /*Ctxt=*/nullptr, suppressErrorMessages); + yin2 >> seq2; + EXPECT_TRUE(!!yin2.error()); + + EXPECT_TRUE(seq.size() == 3); + EXPECT_TRUE(seq.size() == seq2.size()); + for (size_t i = 0; i < seq.size(); ++i) + EXPECT_TRUE(seq[i] == seq2[i]); } // // Test error handling reading built-in Hex64 type // -LLVM_YAML_IS_SEQUENCE_VECTOR(Hex64) TEST(YAMLIO, TestReadBuiltInTypesHex64Error) { std::vector seq; Input yin("---\n" @@ -2255,8 +2288,20 @@ /*Ctxt=*/nullptr, suppressErrorMessages); yin >> seq; - EXPECT_TRUE(!!yin.error()); + + std::vector seq2; + Input yin2("---\n" + "[ 0x0012, 0xFFEEDDCCBBAA9988, 0x12345567890ABCDEF0 ]\n" + "...\n", + /*Ctxt=*/nullptr, suppressErrorMessages); + yin2 >> seq2; + EXPECT_TRUE(!!yin2.error()); + + EXPECT_TRUE(seq.size() == 3); + EXPECT_TRUE(seq.size() == seq2.size()); + for (size_t i = 0; i < seq.size(); ++i) + EXPECT_TRUE(seq[i] == seq2[i]); } TEST(YAMLIO, TestMalformedMapFailsGracefully) {