summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-09-10 21:48:36 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-09-10 21:48:36 +0000
commita572e8e613889aad8ec083c89288e9909654c262 (patch)
treecf64dc85276e74064f10251c341aea8b1df5aa7a
parent7bb20bd69ed28cad9cff666c977c7c589419bf32 (diff)
downloadbcm5719-llvm-a572e8e613889aad8ec083c89288e9909654c262.tar.gz
bcm5719-llvm-a572e8e613889aad8ec083c89288e9909654c262.zip
Mark two methods const.
While at it, optimize getOffset a bit. llvm-svn: 247342
-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