aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Windows/Process.inc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Windows/Process.inc')
-rw-r--r--llvm/lib/Support/Windows/Process.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc
index dfaab1613de1..b0c55a77bc93 100644
--- a/llvm/lib/Support/Windows/Process.inc
+++ b/llvm/lib/Support/Windows/Process.inc
@@ -156,9 +156,10 @@ static std::error_code WildcardExpand(StringRef Arg,
// Don't expand Arg if it does not contain any wildcard characters. This is
// the common case. Also don't wildcard expand /?. Always treat it as an
- // option.
+ // option. Paths that start with \\?\ are absolute paths, and aren't
+ // expected to be used with wildcard expressions.
if (Arg.find_first_of("*?") == StringRef::npos || Arg == "/?" ||
- Arg == "-?") {
+ Arg == "-?" || Arg.startswith("\\\\?\\")) {
Args.push_back(Arg.data());
return EC;
}
@@ -247,7 +248,7 @@ windows::GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
SmallVector<const char *, 20> TmpArgs;
StringSaver Saver(Alloc);
- cl::TokenizeWindowsCommandLine(Cmd, Saver, TmpArgs, /*MarkEOLs=*/false);
+ cl::TokenizeWindowsCommandLineFull(Cmd, Saver, TmpArgs, /*MarkEOLs=*/false);
for (const char *Arg : TmpArgs) {
EC = WildcardExpand(Arg, Args, Saver);
@@ -255,6 +256,9 @@ windows::GetCommandLineArguments(SmallVectorImpl<const char *> &Args,
return EC;
}
+ if (Args.size() == 0)
+ return std::make_error_code(std::errc::invalid_argument);
+
SmallVector<char, MAX_PATH> Arg0(Args[0], Args[0] + strlen(Args[0]));
SmallVector<char, MAX_PATH> Filename;
sys::path::remove_filename(Arg0);