Skip to content

Commit 4508d6a

Browse files
authored
[AArch64][ELF Parser] Fix out-of-scope variable usage (#130576)
Return a reference to a persistent variable instead of a temporary copy.
1 parent 88f010a commit 4508d6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Support/ELFAttrParserExtended.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ ELFExtendedAttrParser::getAttributeValue(unsigned Tag) const {
3232
std::optional<unsigned>
3333
ELFExtendedAttrParser::getAttributeValue(StringRef BuildAttrSubsectionName,
3434
unsigned Tag) const {
35-
for (auto SubSection : SubSectionVec) {
35+
for (const auto &SubSection : SubSectionVec) {
3636
if (BuildAttrSubsectionName == SubSection.Name)
37-
for (auto BAItem : SubSection.Content) {
37+
for (const auto &BAItem : SubSection.Content) {
3838
if (Tag == BAItem.Tag)
3939
return std::optional<unsigned>(BAItem.IntValue);
4040
}

0 commit comments

Comments
 (0)