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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 00:55:06 PST 2025


================
@@ -1599,6 +1599,8 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
     // When the Type string does not have a "SHT_" prefix, we know it is not a
     // description of a regular ELF output section.
     TypeStr = getStringValue(IO, "Type");
+    // To for fallback to `default` in switch below on error.
----------------
jh7370 wrote:

The "To for" part of this appears to be a bit garbled.

That being said, please see my other comments - it would be better to initialise it at point of declaration, or better yet, do something in `mapRequired` to set a value if the field is missing.

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


More information about the llvm-commits mailing list