[llvm] [yaml2obj] Don't use uninitialized Type (PR #123274)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 18:47:20 PST 2025


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 877e727d2c9a40f012ebd78ff07cabac348b60bb 1576e595f4d46dbe2dd8918e1134b0b8b24bafec --extensions cpp -- llvm/lib/ObjectYAML/ELFYAML.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 961815392a..ae7700bbae 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1601,10 +1601,10 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
     TypeStr = getStringValue(IO, "Type");
     if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) {
       IO.mapRequired("Type", Type);
-      if (static_cast<Input&>(IO).error())
+      if (static_cast<Input &>(IO).error())
         Type = ELF::SHT_NULL;
     }
-   }
+  }
 
   if (TypeStr == "Fill") {
     assert(!IO.outputting()); // We don't dump fills currently.

``````````

</details>


https://github.com/llvm/llvm-project/pull/123274


More information about the llvm-commits mailing list