diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index a9ff25c0c09080..242b87c0d1d0ec 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -1359,7 +1359,7 @@ void ELFState::writeSectionContent( // Write the address of the function. CBA.write(E.Address, ELFT::TargetEndianness); // Write number of BBEntries (number of basic blocks in the function). This - // is overriden by the 'NumBlocks' YAML field if specified. + // is overridden by the 'NumBlocks' YAML field when specified. uint32_t NumBlocks = E.NumBlocks.getValueOr(E.BBEntries ? E.BBEntries->size() : 0); SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(NumBlocks); diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index 8267ac9c596d03..f4bdba1aa27242 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -1665,8 +1665,8 @@ void MappingTraits::mapping( IO &IO, ELFYAML::BBAddrMapEntry &E) { assert(IO.getContext() && "The IO context is not initialized"); IO.mapOptional("Address", E.Address, Hex64(0)); - IO.mapOptional("BBEntries", E.BBEntries); IO.mapOptional("NumBlocks", E.NumBlocks); + IO.mapOptional("BBEntries", E.BBEntries); } void MappingTraits::mapping( diff --git a/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml b/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml index d9c46bcacaa87e..b5218f91ea00ad 100644 --- a/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml +++ b/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml @@ -130,8 +130,8 @@ Sections: - Address: 0x20 ## Check that obj2yaml uses the "Content" tag to describe an .llvm_bb_addr_map section -## when it can't extract the entries, for example, when section is truncated, or when -## an invalid NumBlocks field is specified. +## when it can't extract the entries, for example, when the section is truncated, or +## when an invalid 'NumBlocks' field is specified. # RUN: yaml2obj --docnum=1 -DSIZE=0x8 %s -o %t4 # RUN: obj2yaml %t4 | FileCheck %s --check-prefixes=TRUNCATED,INVALID diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp index 56fa43c033178b..bbe5d7283bc56f 100644 --- a/llvm/tools/obj2yaml/elf2yaml.cpp +++ b/llvm/tools/obj2yaml/elf2yaml.cpp @@ -861,7 +861,7 @@ ELFDumper::dumpBBAddrMapSection(const Elf_Shdr *Shdr) { uint64_t Metadata = Data.getULEB128(Cur); BBEntries.push_back({Offset, Size, Metadata}); } - Entries.push_back({Address, /* NumBlocks */ {}, BBEntries}); + Entries.push_back({Address, /*NumBlocks=*/{}, BBEntries}); } if (!Cur) {