[llvm] [YAML] Init local var not set by some branches (#123137) (PR #123273)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 18:41:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-objectyaml
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
It will not be set if:
1. `(TypeStr.starts_with("SHT_") || isInteger(TypeStr)) == false`: here
we want go to switch default.
2. `IO.mapRequired("Type", Type);` fail parsing. It sets error
internally, so probably not important what happen next, so it's go to
the switch
---
Full diff: https://github.com/llvm/llvm-project/pull/123273.diff
1 Files Affected:
- (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 7e94d01a971534..83e6cf76dd746f 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1588,7 +1588,7 @@ static bool isInteger(StringRef Val) {
void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
IO &IO, std::unique_ptr<ELFYAML::Chunk> &Section) {
- ELFYAML::ELF_SHT Type;
+ ELFYAML::ELF_SHT Type = ELF::ET_NONE;
StringRef TypeStr;
if (IO.outputting()) {
if (auto *S = dyn_cast<ELFYAML::Section>(Section.get()))
``````````
</details>
https://github.com/llvm/llvm-project/pull/123273
More information about the llvm-commits
mailing list