[llvm] [obj2yaml] Add ability to dump GOFF header records (PR #200534)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 29 17:50:28 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/tools/obj2yaml/goff2yaml.cpp llvm/include/llvm/Object/GOFF.h llvm/include/llvm/Object/GOFFObjectFile.h llvm/include/llvm/ObjectYAML/GOFFYAML.h llvm/lib/Object/GOFFObjectFile.cpp llvm/lib/Object/ObjectFile.cpp llvm/lib/ObjectYAML/GOFFEmitter.cpp llvm/tools/obj2yaml/obj2yaml.cpp llvm/tools/obj2yaml/obj2yaml.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/tools/obj2yaml/goff2yaml.cpp b/llvm/tools/obj2yaml/goff2yaml.cpp
index 32994ed0f..af7ba8074 100644
--- a/llvm/tools/obj2yaml/goff2yaml.cpp
+++ b/llvm/tools/obj2yaml/goff2yaml.cpp
@@ -52,8 +52,8 @@ Error GOFFDumper::dumpHeader(ArrayRef<uint8_t> Data) {
DataExtractor DE(Data, false, 0);
DataExtractor::Cursor C(0);
- // Flattened data contains: PTV header (bytes 0-2) + bytes 3-60 (prefix) + data from byte 60 onwards
- // HDR data starts at byte 4 in the original record
+ // Flattened data contains: PTV header (bytes 0-2) + bytes 3-60 (prefix) +
+ // data from byte 60 onwards HDR data starts at byte 4 in the original record
C.seek(4); // Skip PTV header and record type
YAMLObj.Header.TargetEnvironment = DE.getU32(C);
YAMLObj.Header.TargetOperatingSystem = DE.getU32(C);
@@ -108,9 +108,9 @@ Error GOFFDumper::dump() {
Error Err = Error::success();
// Use the pre-flattened data structure instead of iterating through records
- const auto& FlattenedData = Obj.getFlattenedData();
+ const auto &FlattenedData = Obj.getFlattenedData();
- for (const auto& [RecordType, Data] : FlattenedData) {
+ for (const auto &[RecordType, Data] : FlattenedData) {
switch (RecordType) {
case GOFF::RT_HDR:
if (auto Err = dumpHeader(Data))
``````````
</details>
https://github.com/llvm/llvm-project/pull/200534
More information about the llvm-commits
mailing list