We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2acec3e commit 0f47627Copy full SHA for 0f47627
llvm/lib/ObjectYAML/COFFEmitter.cpp
@@ -125,15 +125,12 @@ struct COFFParser {
125
}
126
127
unsigned getStringIndex(StringRef Str) {
128
- StringMap<unsigned>::iterator i = StringTableMap.find(Str);
129
- if (i == StringTableMap.end()) {
130
- unsigned Index = StringTable.size();
+ auto [It, Inserted] = StringTableMap.try_emplace(Str, StringTable.size());
+ if (Inserted) {
131
StringTable.append(Str.begin(), Str.end());
132
StringTable.push_back(0);
133
- StringTableMap[Str] = Index;
134
- return Index;
135
136
- return i->second;
+ return It->second;
137
138
139
COFFYAML::Object &Obj;
0 commit comments