diff options
author | Adrian McCarthy <amccarth@google.com> | 2016-06-17 19:45:59 +0000 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2016-06-17 19:45:59 +0000 |
commit | 7a5813597dad665e4461372edbc3a6ea8e8cb8f0 (patch) | |
tree | a0659b3ff29011cf2c87a369501ad5a23184bd39 /llvm/lib/Support/Windows | |
parent | b49aa5c0c4307b82b92cf0b41a5aaeb7c32c710f (diff) | |
download | bcm5719-llvm-7a5813597dad665e4461372edbc3a6ea8e8cb8f0.tar.gz bcm5719-llvm-7a5813597dad665e4461372edbc3a6ea8e8cb8f0.zip |
Revert "Properly handle short file names on the command line in Windows"
This reverts commit 3e5651782cfc985fca9d94595cad63059e587e2f.
llvm-svn: 273033
Diffstat (limited to 'llvm/lib/Support/Windows')
-rw-r--r-- | llvm/lib/Support/Windows/Process.inc | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc index 12b1b4dcf3a..3aef79fee84 100644 --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -201,9 +201,6 @@ WildcardExpand(const wchar_t *Arg, SmallVectorImpl<const char *> &Args, const int DirSize = Dir.size(); // Search for matching files. - // FIXME: This assumes the wildcard is only in the file name and not in the - // directory portion of the file path. For example, it doesn't handle - // "*\foo.c" nor "s?c\bar.cpp". WIN32_FIND_DATAW FileData; HANDLE FindHandle = FindFirstFileW(Arg, &FileData); if (FindHandle == INVALID_HANDLE_VALUE) { @@ -218,7 +215,7 @@ WildcardExpand(const wchar_t *Arg, SmallVectorImpl<const char *> &Args, if (ec) break; - // Append FileName to Dir, and remove it afterwards. + // Push the filename onto Dir, and remove it afterwards. llvm::sys::path::append(Dir, StringRef(FileName.data(), FileName.size())); AllocateAndPush(Dir, Args, Allocator); Dir.resize(DirSize); @@ -228,23 +225,6 @@ WildcardExpand(const wchar_t *Arg, SmallVectorImpl<const char *> &Args, return ec; } -static std::error_code -ExpandShortFileName(const wchar_t *Arg, SmallVectorImpl<const char *> &Args, - SpecificBumpPtrAllocator<char> &Allocator) { - SmallVector<wchar_t, MAX_PATH> LongPath; - DWORD Length = GetLongPathNameW(Arg, LongPath.data(), LongPath.capacity()); - if (Length == 0) - return mapWindowsError(GetLastError()); - if (Length > LongPath.capacity()) { - // We're not going to try to deal with paths longer than MAX_PATH, so we'll - // treat this as an error. GetLastError() returns ERROR_SUCCESS, which - // isn't useful, so we'll hardcode an appropriate error value. - return mapWindowsError(ERROR_INSUFFICIENT_BUFFER); - } - LongPath.set_size(Length); - return ConvertAndPushArg(LongPath.data(), Args, Allocator); -} - std::error_code Process::GetArgumentVector(SmallVectorImpl<const char *> &Args, ArrayRef<const char *>, @@ -258,12 +238,7 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &Args, Args.reserve(ArgCount); std::error_code ec; - // If the first argument is a shortenedd (8.3) name, the driver will have - // trouble distinguishing it (e.g., clang.exe v. clang++.exe), so make sure - // it's a full name. - ec = ExpandShortFileName(UnicodeCommandLine[0], Args, ArgAllocator); - - for (int i = 1; i < ArgCount && !ec; ++i) { + for (int i = 0; i < ArgCount; ++i) { ec = WildcardExpand(UnicodeCommandLine[i], Args, ArgAllocator); if (ec) break; |