From 0562d17864831f25e10691ee1bb60d7abd4dcf97 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 9 Jul 2021 13:52:39 -0700 Subject: [PATCH] PR51018: A few more explicit conversions from SmallString to StringRef Follow-up to 1def2579e10dd84405465f403e8c31acebff0c97 with a few more obscure cases. --- llvm/include/llvm/MC/MCFragment.h | 2 +- llvm/lib/Support/Windows/Process.inc | 2 +- llvm/utils/TableGen/OptParserEmitter.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h index 000b0e3..f3a785f 100644 --- a/llvm/include/llvm/MC/MCFragment.h +++ b/llvm/include/llvm/MC/MCFragment.h @@ -553,7 +553,7 @@ public: 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 c0e9781..6f58c52 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 8e6c058..0809432 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"; } -- 2.7.4