[lld] r283290 - Use StringRef in StringSaver API (NFC)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 18:32:41 PDT 2016
Author: mehdi_amini
Date: Tue Oct 4 20:32:41 2016
New Revision: 283290
URL: http://llvm.org/viewvc/llvm-project?rev=283290&view=rev
Log:
Use StringRef in StringSaver API (NFC)
Modified:
lld/trunk/COFF/DriverUtils.cpp
Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=283290&r1=283289&r2=283290&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Tue Oct 4 20:32:41 2016
@@ -43,16 +43,16 @@ namespace {
class Executor {
public:
explicit Executor(StringRef S) : Saver(Alloc), Prog(Saver.save(S)) {}
- void add(StringRef S) { Args.push_back(Saver.save(S)); }
- void add(std::string &S) { Args.push_back(Saver.save(S)); }
- void add(Twine S) { Args.push_back(Saver.save(S)); }
- void add(const char *S) { Args.push_back(Saver.save(S)); }
+ void add(StringRef S) { Args.push_back(Saver.save(S).data()); }
+ void add(std::string &S) { Args.push_back(Saver.save(S).data()); }
+ void add(Twine S) { Args.push_back(Saver.save(S).data()); }
+ void add(const char *S) { Args.push_back(Saver.save(S).data()); }
void run() {
ErrorOr<std::string> ExeOrErr = llvm::sys::findProgramByName(Prog);
if (auto EC = ExeOrErr.getError())
fatal(EC, "unable to find " + Prog + " in PATH: ");
- const char *Exe = Saver.save(*ExeOrErr);
+ const char *Exe = Saver.save(*ExeOrErr).data();
Args.insert(Args.begin(), Exe);
Args.push_back(nullptr);
if (llvm::sys::ExecuteAndWait(Args[0], Args.data()) != 0) {
More information about the llvm-commits
mailing list