Skip to content

Conversation

@vitalybuka
Copy link
Collaborator

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

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Jan 17, 2025

@llvm/pr-subscribers-objectyaml

Author: Vitaly Buka (vitalybuka)

Changes

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 --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()))

@vitalybuka vitalybuka closed this Jan 17, 2025
@vitalybuka
Copy link
Collaborator Author

Not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants