[llvm] r271181 - Remove some 'const' specifiers that do nothing but prevent moving the argument.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sun May 29 03:46:42 PDT 2016


Author: d0k
Date: Sun May 29 05:46:35 2016
New Revision: 271181

URL: http://llvm.org/viewvc/llvm-project?rev=271181&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/IR/Function.h
    llvm/trunk/include/llvm/Transforms/Utils/LoopVersioning.h
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/IR/Function.cpp
    llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp
    llvm/trunk/tools/obj2yaml/Error.h

Modified: llvm/trunk/include/llvm/IR/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Function.h (original)
+++ llvm/trunk/include/llvm/IR/Function.h Sun May 29 05:46:35 2016
@@ -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.

Modified: llvm/trunk/include/llvm/Transforms/Utils/LoopVersioning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/LoopVersioning.h?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/LoopVersioning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/LoopVersioning.h Sun May 29 05:46:35 2016
@@ -73,7 +73,7 @@ public:
 
   /// \brief Sets the runtime alias checks for versioning the loop.
   void setAliasChecks(
-      const SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks);
+      SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks);
 
   /// \brief Sets the runtime SCEV checks for versioning the loop.
   void setSCEVChecks(SCEVUnionPredicate Check);

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun May 29 05:46:35 2016
@@ -4668,7 +4668,7 @@ bool LLParser::ParseFunctionHeader(Funct
   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;

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun May 29 05:46:35 2016
@@ -3863,7 +3863,7 @@ std::error_code BitcodeReader::parseModu
       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)

Modified: llvm/trunk/lib/IR/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Function.cpp (original)
+++ llvm/trunk/lib/IR/Function.cpp Sun May 29 05:46:35 2016
@@ -405,7 +405,7 @@ const std::string &Function::getGC() con
   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));
 }

Modified: llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp Sun May 29 05:46:35 2016
@@ -44,7 +44,7 @@ LoopVersioning::LoopVersioning(const Loo
 }
 
 void LoopVersioning::setAliasChecks(
-    const SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks) {
+    SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks) {
   AliasChecks = std::move(Checks);
 }
 

Modified: llvm/trunk/tools/obj2yaml/Error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/Error.h?rev=271181&r1=271180&r2=271181&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/Error.h (original)
+++ llvm/trunk/tools/obj2yaml/Error.h Sun May 29 05:46:35 2016
@@ -33,7 +33,7 @@ class Obj2YamlError : public ErrorInfo<O
 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;




More information about the llvm-commits mailing list