Release Notes: RegisterScheduler::setDefault removed; by Mehdi Amini
[oota-llvm.git] / include / llvm / TableGen / StringToOffsetTable.h
index a044a3c53f03157dba96e15606d64680f545866b..e3277036dc76a85062975ba201993fc9c67128ee 100644 (file)
@@ -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) {