[llvm] r248136 - Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 20 17:18:00 PDT 2015


Author: ctopper
Date: Sun Sep 20 19:18:00 2015
New Revision: 248136

URL: http://llvm.org/viewvc/llvm-project?rev=248136&view=rev
Log:
Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC

Modified:
    llvm/trunk/include/llvm/Target/TargetRecip.h
    llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
    llvm/trunk/lib/Target/TargetRecip.cpp

Modified: llvm/trunk/include/llvm/Target/TargetRecip.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRecip.h?rev=248136&r1=248135&r2=248136&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRecip.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRecip.h Sun Sep 20 19:18:00 2015
@@ -35,16 +35,16 @@ public:
   /// Set whether a particular reciprocal operation is enabled and how many
   /// refinement steps are needed when using it. Use "all" to set enablement
   /// and refinement steps for all operations.
-  void setDefaults(const StringRef &Key, bool Enable, unsigned RefSteps);
+  void setDefaults(StringRef Key, bool Enable, unsigned RefSteps);
 
   /// Return true if the reciprocal operation has been enabled by default or
   /// from the command-line. Return false if the operation has been disabled
   /// by default or from the command-line.
-  bool isEnabled(const StringRef &Key) const;
+  bool isEnabled(StringRef Key) const;
 
   /// Return the number of iterations necessary to refine the
   /// the result of a machine instruction for the given reciprocal operation.
-  unsigned getRefinementSteps(const StringRef &Key) const;
+  unsigned getRefinementSteps(StringRef Key) const;
 
   bool operator==(const TargetRecip &Other) const;
 

Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=248136&r1=248135&r2=248136&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Sun Sep 20 19:18:00 2015
@@ -464,7 +464,7 @@ static unsigned getRegClass(bool IsVgpr,
   }
 }
 
-static unsigned getRegForName(const StringRef &RegName) {
+static unsigned getRegForName(StringRef RegName) {
 
   return StringSwitch<unsigned>(RegName)
     .Case("exec", AMDGPU::EXEC)

Modified: llvm/trunk/lib/Target/TargetRecip.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRecip.cpp?rev=248136&r1=248135&r2=248136&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetRecip.cpp (original)
+++ llvm/trunk/lib/Target/TargetRecip.cpp Sun Sep 20 19:18:00 2015
@@ -46,7 +46,7 @@ TargetRecip::TargetRecip() {
     RecipMap.insert(std::make_pair(RecipOps[i], RecipParams()));
 }
 
-static bool parseRefinementStep(const StringRef &In, size_t &Position,
+static bool parseRefinementStep(StringRef In, size_t &Position,
                                 uint8_t &Value) {
   const char RefStepToken = ':';
   Position = In.find(RefStepToken);
@@ -175,7 +175,7 @@ TargetRecip::TargetRecip(const std::vect
   parseIndividualParams(Args);
 }
 
-bool TargetRecip::isEnabled(const StringRef &Key) const {
+bool TargetRecip::isEnabled(StringRef Key) const {
   ConstRecipIter Iter = RecipMap.find(Key);
   assert(Iter != RecipMap.end() && "Unknown name for reciprocal map");
   assert(Iter->second.Enabled != Uninitialized &&
@@ -183,7 +183,7 @@ bool TargetRecip::isEnabled(const String
   return Iter->second.Enabled;
 }
 
-unsigned TargetRecip::getRefinementSteps(const StringRef &Key) const {
+unsigned TargetRecip::getRefinementSteps(StringRef Key) const {
   ConstRecipIter Iter = RecipMap.find(Key);
   assert(Iter != RecipMap.end() && "Unknown name for reciprocal map");
   assert(Iter->second.RefinementSteps != Uninitialized &&
@@ -192,7 +192,7 @@ unsigned TargetRecip::getRefinementSteps
 }
 
 /// Custom settings (previously initialized values) override target defaults.
-void TargetRecip::setDefaults(const StringRef &Key, bool Enable,
+void TargetRecip::setDefaults(StringRef Key, bool Enable,
                               unsigned RefSteps) {
   if (Key == "all") {
     for (auto &KV : RecipMap) {
@@ -213,7 +213,7 @@ void TargetRecip::setDefaults(const Stri
 
 bool TargetRecip::operator==(const TargetRecip &Other) const {
   for (const auto &KV : RecipMap) {
-    const StringRef &Op = KV.first;
+    StringRef Op = KV.first;
     const RecipParams &RP = KV.second;
     const RecipParams &OtherRP = Other.RecipMap.find(Op)->second;
     if (RP.RefinementSteps != OtherRP.RefinementSteps)




More information about the llvm-commits mailing list