@@ -51,11 +51,9 @@ StringRef
51
51
ELFExtendedAttrParser::getTagName (const StringRef &BuildAttrSubsectionName,
52
52
const unsigned Tag) {
53
53
for (const auto &Entry : TagsNamesMap) {
54
- if (BuildAttrSubsectionName == Entry.SubsectionName ) {
55
- if (Tag == Entry.Tag ) {
54
+ if (BuildAttrSubsectionName == Entry.SubsectionName )
55
+ if (Tag == Entry.Tag )
56
56
return Entry.TagName ;
57
- }
58
- }
59
57
}
60
58
return " " ;
61
59
}
@@ -136,23 +134,21 @@ Error ELFExtendedAttrParser::parse(ArrayRef<uint8_t> Section,
136
134
(OffsetInSection + ExtBASubsectionLength - BytesAllButAttributes)) {
137
135
138
136
uint64_t Tag = De.getULEB128 (Cursor);
139
- std::string Str = utostr (Tag);
140
- StringRef TagStr (Str);
141
137
142
- StringRef TagAsString = getTagName (VendorName, Tag);
143
- if (" " != TagAsString )
144
- TagStr = TagAsString ;
138
+ StringRef TagName = getTagName (VendorName, Tag);
139
+ if (" " == TagName )
140
+ TagName = StringRef ( utostr (Tag)) ;
145
141
146
142
uint64_t ValueInt = 0 ;
147
143
std::string ValueStr = " " ;
148
144
if (Type) { // type==1 --> ntbs
149
145
StringRef Value = De.getCStrRef (Cursor);
150
146
if (Sw)
151
- Sw->printString (TagStr , Value);
147
+ Sw->printString (TagName , Value);
152
148
} else { // type==0 --> uleb128
153
149
uint64_t Value = De.getULEB128 (Cursor);
154
150
if (Sw)
155
- Sw->printNumber (TagStr , Value);
151
+ Sw->printNumber (TagName , Value);
156
152
}
157
153
158
154
// populate data structure
0 commit comments