Skip to content

Commit 319c119

Browse files
authored
[YAML] Init local var not set by some branches (#123137)
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
1 parent 42662c2 commit 319c119

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ static bool isInteger(StringRef Val) {
15881588

15891589
void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
15901590
IO &IO, std::unique_ptr<ELFYAML::Chunk> &Section) {
1591-
ELFYAML::ELF_SHT Type;
1591+
ELFYAML::ELF_SHT Type = ELF::ET_NONE;
15921592
StringRef TypeStr;
15931593
if (IO.outputting()) {
15941594
if (auto *S = dyn_cast<ELFYAML::Section>(Section.get()))

0 commit comments

Comments
 (0)