[PATCH] D22015: [ELF] Introduce a flag to parse response file according to windows rules
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 6 13:47:54 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/DriverUtils.cpp:53
@@ -51,1 +52,3 @@
+static StringRef getQuotingStyle(opt::InputArgList &Args) {
+ StringRef RspQuoting = "";
----------------
Return either cl::TokenizeWindowsCommandLine or cl::TokenizeGNUCommandLine.
================
Comment at: ELF/DriverUtils.cpp:55-56
@@ +54,4 @@
+ StringRef RspQuoting = "";
+ if (auto *Arg = Args.getLastArg(OPT_rsp_quoting))
+ RspQuoting = Arg->getValue();
+ if (RspQuoting.empty())
----------------
if (auto *Arg = Args.getLastArg(OPT_rsp_quoting)) {
StringRef S = Arg->getValue();
if (S != "windows" && S != "posix")
error("invalid response file quoting: " + S);
if (S == "windows")
return cl::TokenizeWindowsCommandLine;
return cl::TokenizeGNUCommandLine;
}
================
Comment at: ELF/DriverUtils.cpp:58-60
@@ +57,5 @@
+ if (RspQuoting.empty())
+ RspQuoting = Triple(sys::getProcessTriple()).getOS() == Triple::Win32
+ ? "windows"
+ : "posix";
+ if (RspQuoting != "windows" && RspQuoting != "posix")
----------------
if (Triple(sys::getProcessTriple()).getOS() == Triple::Win32)
return cl::TokenizeWindowsCommandLine;
return cl::TokenizeGNUCommandLine;
================
Comment at: ELF/DriverUtils.cpp:71-75
@@ -56,2 +70,7 @@
unsigned MissingCount;
+ SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
+
+ // We need to get the quoting style for response files before parsing all options,
+ // so we parse here before and ignore all the options but --rsp-quoting.
+ opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
----------------
Please move this code inside getQuotingStyle.
http://reviews.llvm.org/D22015
More information about the llvm-commits
mailing list