diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-01 03:19:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-01 03:19:09 +0000 |
commit | 86e1c9484f0c674651022c741227eb60749e289c (patch) | |
tree | 31e32151136106d527fecb682fc00fc2e247ff7b /llvm/utils/TableGen/CodeGenInstruction.cpp | |
parent | a397716081cbe16250ce937ea252b65d7ba5fa94 (diff) | |
download | bcm5719-llvm-86e1c9484f0c674651022c741227eb60749e289c.tar.gz bcm5719-llvm-86e1c9484f0c674651022c741227eb60749e289c.zip |
avoid needless throw/catch/rethrow, stringref'ize some simple stuff.
llvm-svn: 117892
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenInstruction.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index 41a27cea3dd..259e7c36a4c 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/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) |