Fix some C++ value / reference semantics issues.
Some functions were taking Twine's not by const&, these are all
fixed to take by const&. We also had a case where some functions
were overloaded to accept by const& and &&. Now there is only
one version which accepts by value and move's the value.
llvm-svn: 315229
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.h b/llvm/tools/llvm-rc/ResourceScriptParser.h
index f2afe6d..1a124d4 100644
--- a/llvm/tools/llvm-rc/ResourceScriptParser.h
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.h
@@ -36,7 +36,7 @@
// Class describing a single failure of parser.
class ParserError : public ErrorInfo<ParserError> {
public:
- ParserError(Twine Expected, const LocIter CurLoc, const LocIter End);
+ ParserError(const Twine &Expected, const LocIter CurLoc, const LocIter End);
void log(raw_ostream &OS) const override { OS << CurMessage; }
std::error_code convertToErrorCode() const override {
@@ -51,8 +51,7 @@
LocIter ErrorLoc, FileEnd;
};
- RCParser(const std::vector<RCToken> &TokenList);
- RCParser(std::vector<RCToken> &&TokenList);
+ RCParser(std::vector<RCToken> TokenList);
// Reads and returns a single resource definition, or error message if any
// occurred.
@@ -172,7 +171,7 @@
// the token that couldn't be parsed. If the flag is on, this complains about
// the correctly read token that makes no sense (that is, the current parser
// state is beyond the erroneous token.)
- Error getExpectedError(const Twine Message, bool IsAlreadyRead = false);
+ Error getExpectedError(const Twine &Message, bool IsAlreadyRead = false);
std::vector<RCToken> Tokens;
LocIter CurLoc;