[llvm] 0562d17 - PR51018: A few more explicit conversions from SmallString to StringRef

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 13:54:12 PDT 2021


Author: David Blaikie
Date: 2021-07-09T13:54:02-07:00
New Revision: 0562d17864831f25e10691ee1bb60d7abd4dcf97

URL: https://github.com/llvm/llvm-project/commit/0562d17864831f25e10691ee1bb60d7abd4dcf97
DIFF: https://github.com/llvm/llvm-project/commit/0562d17864831f25e10691ee1bb60d7abd4dcf97.diff

LOG: PR51018: A few more explicit conversions from SmallString to StringRef

Follow-up to 1def2579e10dd84405465f403e8c31acebff0c97 with a few more
obscure cases.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCFragment.h
    llvm/lib/Support/Windows/Process.inc
    llvm/utils/TableGen/OptParserEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 000b0e33e1173..f3a785fb09b7f 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -553,7 +553,7 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
     return Ranges;
   }
 
-  StringRef getFixedSizePortion() const { return FixedSizePortion; }
+  StringRef getFixedSizePortion() const { return FixedSizePortion.str(); }
 
   static bool classof(const MCFragment *F) {
     return F->getKind() == MCFragment::FT_CVDefRange;

diff  --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc
index c0e97815167dd..6f58c52e07464 100644
--- a/llvm/lib/Support/Windows/Process.inc
+++ b/llvm/lib/Support/Windows/Process.inc
@@ -194,7 +194,7 @@ static std::error_code WildcardExpand(StringRef Arg,
 
     // Append FileName to Dir, and remove it afterwards.
     llvm::sys::path::append(Dir, FileName);
-    Args.push_back(Saver.save(StringRef(Dir)).data());
+    Args.push_back(Saver.save(Dir.str()).data());
     Dir.resize(DirSize);
   } while (FindNextFileW(FindHandle, &FileData));
 

diff  --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp
index 8e6c05885e5b0..0809432dfd0d2 100644
--- a/llvm/utils/TableGen/OptParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptParserEmitter.cpp
@@ -251,7 +251,7 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
 
     // Prefix values.
     OS << ", {";
-    for (StringRef PrefixKey : Prefix.first)
+    for (const auto &PrefixKey : Prefix.first)
       OS << "\"" << PrefixKey << "\" COMMA ";
     OS << "nullptr})\n";
   }


        


More information about the llvm-commits mailing list