aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-01 03:19:09 +0000
committerChris Lattner <sabre@nondot.org>2010-11-01 03:19:09 +0000
commit79b3cddfa2eeb9ed7f93daf8e4f3c3d87779c3ab (patch)
tree95033d2d0d1a29fc33dbb68f80c7173337266e8e /utils/TableGen/CodeGenInstruction.cpp
parentf78081145695baa5d0b004e674c4561245b13b52 (diff)
avoid needless throw/catch/rethrow, stringref'ize some simple stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index 41a27cea3d..259e7c36a4 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -237,17 +237,17 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R) {
/// non-empty name. If the instruction does not have an operand with the
/// specified name, throw an exception.
///
-unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
+unsigned CodeGenInstruction::getOperandNamed(StringRef Name) const {
unsigned OpIdx;
if (hasOperandNamed(Name, OpIdx)) return OpIdx;
throw "Instruction '" + TheDef->getName() +
- "' does not have an operand named '$" + Name + "'!";
+ "' does not have an operand named '$" + Name.str() + "'!";
}
/// hasOperandNamed - Query whether the instruction has an operand of the
/// given name. If so, return true and set OpIdx to the index of the
/// operand. Otherwise, return false.
-bool CodeGenInstruction::hasOperandNamed(const std::string &Name,
+bool CodeGenInstruction::hasOperandNamed(StringRef Name,
unsigned &OpIdx) const {
assert(!Name.empty() && "Cannot search for operand with no name!");
for (unsigned i = 0, e = OperandList.size(); i != e; ++i)