Skip to content

Commit a5c33e6

Browse files
authored
[AArch64][ELF Parser] Fix out-of-scope variable usage (#130594)
Return a reference to a persistent variable instead of a temporary copy.
1 parent 7fb71d1 commit a5c33e6

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
@@ -53,9 +53,9 @@ ELFExtendedAttrParser::getAttributeString(unsigned Tag) const {
5353
std::optional<StringRef>
5454
ELFExtendedAttrParser::getAttributeString(StringRef BuildAttrSubsectionName,
5555
unsigned Tag) const {
56-
for (auto SubSection : SubSectionVec) {
56+
for (const auto &SubSection : SubSectionVec) {
5757
if (BuildAttrSubsectionName == SubSection.Name)
58-
for (auto BAItem : SubSection.Content) {
58+
for (const auto &BAItem : SubSection.Content) {
5959
if (Tag == BAItem.Tag)
6060
return std::optional<StringRef>(BAItem.StringValue);
6161
}

0 commit comments

Comments
 (0)