1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
llvm-mirror/test/ObjectYAML/MachO/fat_macho_i386_x86_64.yaml
Chris Bieneman f9c29b59f6 [YAML] Fix YAML tags appearing before the start of sequence elements
Our existing yaml::Output code writes tags immediately when mapTag is called, without any state handling. This results in tags on sequence elements being written before the element itself. For example, we see this:

SomeArray:     !elem_type
  - key1:         1
    key2:         2 !elem_type2
  - key3:         3
    key4:         4

We should instead see:

SomeArray:
  - !elem_type
    key1:         1
    key2:         2
  - !elem_type2
    key3:         3
    key4:         4

Our reader handles reading properly, so this bug only impacts writing yaml sequences with tagged elements.

As a test for this I've modified the Mach-O yaml encoding to allways apply the !mach-o tag when encoding MachOYAML::Object entries. This results in the !mach-o tag appearing as expected in dumped fat files.

llvm-svn: 274067
2016-06-28 21:10:26 +00:00

75 lines
2.2 KiB
YAML

# RUN: yaml2obj %s | obj2yaml | FileCheck %s
--- !fat-mach-o
FatHeader:
magic: 0xCAFEBABE
nfat_arch: 2
FatArchs:
- cputype: 0x00000007
cpusubtype: 0x00000003
offset: 0x0000000000001000
size: 15244
align: 12
- cputype: 0x01000007
cpusubtype: 0x80000003
offset: 0x0000000000005000
size: 15380
align: 12
Slices:
- FileHeader:
magic: 0xFEEDFACE
cputype: 0x00000007
cpusubtype: 0x00000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x01218085
- FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x80000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x00218085
reserved: 0x00000000
...
#CHECK: --- !fat-mach-o
#CHECK: FatHeader:
#CHECK: magic: 0xCAFEBABE
#CHECK: nfat_arch: 2
#CHECK: FatArchs:
#CHECK: - cputype: 0x00000007
#CHECK: cpusubtype: 0x00000003
#CHECK: offset: 0x0000000000001000
#CHECK: size: 15244
#CHECK: align: 12
#CHECK: - cputype: 0x01000007
#CHECK: cpusubtype: 0x80000003
#CHECK: offset: 0x0000000000005000
#CHECK: size: 15380
#CHECK: align: 12
#CHECK: Slices:
#CHECK: - !mach-o
#CHECK FileHeader:
#CHECK: magic: 0xFEEDFACE
#CHECK: cputype: 0x00000007
#CHECK: cpusubtype: 0x00000003
#CHECK: filetype: 0x00000002
#CHECK: ncmds: 0
#CHECK: sizeofcmds: 0
#CHECK: flags: 0x01218085
#CHECK: - !mach-o
#CHECK FileHeader:
#CHECK: magic: 0xFEEDFACF
#CHECK: cputype: 0x01000007
#CHECK: cpusubtype: 0x80000003
#CHECK: filetype: 0x00000002
#CHECK: ncmds: 0
#CHECK: sizeofcmds: 0
#CHECK: flags: 0x00218085
#CHECK: reserved: 0x00000000
#CHECK: ...