Don't repeat names in comments and don't indent in namespaces. NFC.
[oota-llvm.git] / include / llvm / MC / StringTableBuilder.h
index 897d449254eab4d4d93909b6fe2b8aecb82d9736..f38247702eb3f1d5dce53b6d8589f1a2010795b7 100644 (file)
@@ -41,23 +41,24 @@ public:
 
   /// \brief Retrieve the string table data. Can only be used after the table
   /// is finalized.
-  StringRef data() {
+  StringRef data() const {
     assert(isFinalized());
     return StringTable;
   }
 
   /// \brief Get the offest of a string in the string table. Can only be used
   /// after the table is finalized.
-  size_t getOffset(StringRef s) {
+  size_t getOffset(StringRef s) const {
     assert(isFinalized());
-    assert(StringIndexMap.count(s) && "String is not in table!");
-    return StringIndexMap[s];
+    auto I = StringIndexMap.find(s);
+    assert(I != StringIndexMap.end() && "String is not in table!");
+    return I->second;
   }
 
   void clear();
 
 private:
-  bool isFinalized() {
+  bool isFinalized() const {
     return !StringTable.empty();
   }
 };