Remove FileCheck from test case token_landingpad.ll.
[oota-llvm.git] / include / llvm / TableGen / StringToOffsetTable.h
index d94d3a266822c9d2c5d0341aab5907e4995d0a60..e3277036dc76a85062975ba201993fc9c67128ee 100644 (file)
@@ -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"
@@ -25,21 +25,21 @@ namespace llvm {
 class StringToOffsetTable {
   StringMap<unsigned> StringOffset;
   std::string AggregateString;
+
 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) {
     // Escape the string.
     SmallString<256> Str;
@@ -55,11 +55,11 @@ public:
       }
       O << AggregateString[i];
       ++CharsPrinted;
-      
+
       // Print escape sequences all together.
       if (AggregateString[i] != '\\')
         continue;
-      
+
       assert(i+1 < AggregateString.size() && "Incomplete escape sequence!");
       if (isdigit(AggregateString[i+1])) {
         assert(isdigit(AggregateString[i+2]) &&