Support: Fix handling of args that begin with @ but aren't files
authorJustin Bogner <mail@justinbogner.com>
Fri, 6 Dec 2013 22:56:19 +0000 (22:56 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 6 Dec 2013 22:56:19 +0000 (22:56 +0000)
Command line arguments that begin with @ but aren't a path to an
existing file currently cause later @file arguments to be ignored.

Correctly skip over these arguments instead of trying to read a
non-existent file 20 times and giving up.

Since the problem manifests in the clang driver, the test is in that
repository.

Fixes rdar://problem/15590906

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196620 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CommandLine.cpp

index 9acaa08bbcc7a4572f7b0e7e9a826d71154c7b15..7ed4dead041e0385ed84f816a055e5b811a19025 100644 (file)
@@ -655,7 +655,10 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
     // the cwd of the process or the response file?
     SmallVector<const char *, 0> ExpandedArgv;
     if (!ExpandResponseFile(Arg + 1, Saver, Tokenizer, ExpandedArgv)) {
+      // We couldn't read this file, so we leave it in the argument stream and
+      // move on.
       AllExpanded = false;
+      ++I;
       continue;
     }
     Argv.erase(Argv.begin() + I);