diff options
Diffstat (limited to 'contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h')
-rw-r--r-- | contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h b/contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h index c924bd8..e327703 100644 --- a/contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h +++ b/contrib/llvm/include/llvm/TableGen/StringToOffsetTable.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef TBLGEN_STRING_TO_OFFSET_TABLE_H -#define TBLGEN_STRING_TO_OFFSET_TABLE_H +#ifndef LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H +#define LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" @@ -28,16 +28,16 @@ class StringToOffsetTable { public: unsigned GetOrAddStringOffset(StringRef Str, bool appendZero = true) { - StringMapEntry<unsigned> &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) { |