summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MC/StringTableBuilder.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/include/llvm/MC/StringTableBuilder.h b/llvm/include/llvm/MC/StringTableBuilder.h
index 897d449254e..3164351d656 100644
--- a/llvm/include/llvm/MC/StringTableBuilder.h
+++ b/llvm/include/llvm/MC/StringTableBuilder.h
@@ -48,16 +48,17 @@ public:
/// \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();
}
};
OpenPOWER on IntegriCloud