[PATCH] D96831: [obj2yaml,yaml2obj] Add NumBlocks to the BBAddrMapEntry yaml field.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 18:09:05 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f527086609e: [obj2yaml,yaml2obj] Add NumBlocks to the BBAddrMapEntry yaml field. (authored by rahmanl).

Changed prior to commit:
  https://reviews.llvm.org/D96831?vs=325632&id=325633#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96831/new/

https://reviews.llvm.org/D96831

Files:
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
  llvm/tools/obj2yaml/elf2yaml.cpp


Index: llvm/tools/obj2yaml/elf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/elf2yaml.cpp
+++ llvm/tools/obj2yaml/elf2yaml.cpp
@@ -861,7 +861,7 @@
       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) {
Index: llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
===================================================================
--- llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
+++ llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
@@ -130,8 +130,8 @@
       - 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
Index: llvm/lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- llvm/lib/ObjectYAML/ELFYAML.cpp
+++ llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1665,8 +1665,8 @@
     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<ELFYAML::BBAddrMapEntry::BBEntry>::mapping(
Index: llvm/lib/ObjectYAML/ELFEmitter.cpp
===================================================================
--- llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -1359,7 +1359,7 @@
     // Write the address of the function.
     CBA.write<uintX_t>(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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96831.325633.patch
Type: text/x-patch
Size: 2474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/1b38a980/attachment.bin>


More information about the llvm-commits mailing list