X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=include%2Fllvm%2FTableGen%2FStringToOffsetTable.h;h=e3277036dc76a85062975ba201993fc9c67128ee;hb=e293d6c8d134ad352bb69defee17c5c902476933;hp=a044a3c53f03157dba96e15606d64680f545866b;hpb=00e08fcaa02286dd7da9cf9a8d158545532ab832;p=oota-llvm.git diff --git a/include/llvm/TableGen/StringToOffsetTable.h b/include/llvm/TableGen/StringToOffsetTable.h index a044a3c53f0..e3277036dc7 100644 --- a/include/llvm/TableGen/StringToOffsetTable.h +++ b/include/llvm/TableGen/StringToOffsetTable.h @@ -28,16 +28,16 @@ class StringToOffsetTable { public: unsigned GetOrAddStringOffset(StringRef Str, bool appendZero = true) { - StringMapEntry &Entry = StringOffset.GetOrCreateValue(Str, -1U); - if (Entry.getValue() == -1U) { + auto IterBool = + StringOffset.insert(std::make_pair(Str, AggregateString.size())); + if (IterBool.second) { // Add the string to the aggregate if this is the first time found. - Entry.setValue(AggregateString.size()); AggregateString.append(Str.begin(), Str.end()); if (appendZero) AggregateString += '\0'; } - return Entry.getValue(); + return IterBool.first->second; } void EmitString(raw_ostream &O) {