From ac307e44e339f7a05c5ec2ad6f0b3616fa91a8d0 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 29 May 2016 10:46:35 +0000 Subject: [PATCH] Remove some 'const' specifiers that do nothing but prevent moving the argument. Found by clang-tidy's misc-move-const-arg. While there drop some obsolete c_str() calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271181 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Function.h | 2 +- include/llvm/Transforms/Utils/LoopVersioning.h | 2 +- lib/AsmParser/LLParser.cpp | 2 +- lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- lib/IR/Function.cpp | 2 +- lib/Transforms/Utils/LoopVersioning.cpp | 2 +- tools/obj2yaml/Error.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index cffb9900bd4..6aeddab4311 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -231,7 +231,7 @@ public: return getSubclassDataFromValue() & (1<<14); } const std::string &getGC() const; - void setGC(const std::string Str); + void setGC(std::string Str); void clearGC(); /// @brief adds the attribute to the list of attributes. diff --git a/include/llvm/Transforms/Utils/LoopVersioning.h b/include/llvm/Transforms/Utils/LoopVersioning.h index cb72fd2d1da..0d345a972e1 100644 --- a/include/llvm/Transforms/Utils/LoopVersioning.h +++ b/include/llvm/Transforms/Utils/LoopVersioning.h @@ -73,7 +73,7 @@ public: /// \brief Sets the runtime alias checks for versioning the loop. void setAliasChecks( - const SmallVector Checks); + SmallVector Checks); /// \brief Sets the runtime SCEV checks for versioning the loop. void setSCEVChecks(SCEVUnionPredicate Check); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index d1f9d4701a3..3f9ea5766bd 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -4668,7 +4668,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { Fn->setSection(Section); Fn->setComdat(C); Fn->setPersonalityFn(PersonalityFn); - if (!GC.empty()) Fn->setGC(GC.c_str()); + if (!GC.empty()) Fn->setGC(GC); Fn->setPrefixData(Prefix); Fn->setPrologueData(Prologue); ForwardRefAttrGroups[Fn] = FwdRefAttrGrps; diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 157408d6240..2cd1297d902 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3863,7 +3863,7 @@ std::error_code BitcodeReader::parseModule(uint64_t ResumeBit, if (Record.size() > 8 && Record[8]) { if (Record[8]-1 >= GCTable.size()) return error("Invalid ID"); - Func->setGC(GCTable[Record[8]-1].c_str()); + Func->setGC(GCTable[Record[8] - 1]); } bool UnnamedAddr = false; if (Record.size() > 9) diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp index 36800eecf84..c8741964564 100644 --- a/lib/IR/Function.cpp +++ b/lib/IR/Function.cpp @@ -405,7 +405,7 @@ const std::string &Function::getGC() const { return getContext().getGC(*this); } -void Function::setGC(const std::string Str) { +void Function::setGC(std::string Str) { setValueSubclassDataBit(14, !Str.empty()); getContext().setGC(*this, std::move(Str)); } diff --git a/lib/Transforms/Utils/LoopVersioning.cpp b/lib/Transforms/Utils/LoopVersioning.cpp index e3f711ffebc..736d79ad81c 100644 --- a/lib/Transforms/Utils/LoopVersioning.cpp +++ b/lib/Transforms/Utils/LoopVersioning.cpp @@ -44,7 +44,7 @@ LoopVersioning::LoopVersioning(const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, } void LoopVersioning::setAliasChecks( - const SmallVector Checks) { + SmallVector Checks) { AliasChecks = std::move(Checks); } diff --git a/tools/obj2yaml/Error.h b/tools/obj2yaml/Error.h index f4e191c872c..f5111f257ce 100644 --- a/tools/obj2yaml/Error.h +++ b/tools/obj2yaml/Error.h @@ -33,7 +33,7 @@ class Obj2YamlError : public ErrorInfo { public: static char ID; Obj2YamlError(obj2yaml_error C) : Code(C) {} - Obj2YamlError(const std::string &ErrMsg) : ErrMsg(std::move(ErrMsg)) {} + Obj2YamlError(std::string ErrMsg) : ErrMsg(std::move(ErrMsg)) {} Obj2YamlError(obj2yaml_error C, std::string ErrMsg) : ErrMsg(std::move(ErrMsg)), Code(C) {} void log(raw_ostream &OS) const override; -- 2.11.0