diff options
| author | Mikhail Glushenkov <foldr@codedgers.com> | 2009-01-21 13:14:02 +0000 |
|---|---|---|
| committer | Mikhail Glushenkov <foldr@codedgers.com> | 2009-01-21 13:14:02 +0000 |
| commit | 6a4f729dc9b46916d149828161102ba0dd69072f (patch) | |
| tree | f1ba2fdba28c32c35b48a9b2b59cbae058934452 /llvm/lib/Support | |
| parent | 1a0c083748e796684acbedbb1733abc16e1b7b1d (diff) | |
| download | bcm5719-llvm-6a4f729dc9b46916d149828161102ba0dd69072f.tar.gz bcm5719-llvm-6a4f729dc9b46916d149828161102ba0dd69072f.zip | |
Mimic gcc behaviour with regard to response files.
llvm-svn: 62688
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 87dfc5a703f..8cd483a25e5 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -388,23 +388,22 @@ static void ExpandResponseFiles(int argc, char** argv, // Check that the response file is not empty (mmap'ing empty // files can be problematic). const sys::FileStatus *FileStat = respFile.getFileStatus(); - if (!FileStat) - continue; - if (FileStat->getSize() == 0) - continue; - - // Mmap the response file into memory. - OwningPtr<MemoryBuffer> - respFilePtr(MemoryBuffer::getFile(respFile.c_str())); - - if (respFilePtr == 0) - continue; - - ParseCStringVector(newArgv, respFilePtr->getBufferStart()); - } - else { - newArgv.push_back(strdup(arg)); + if (FileStat && FileStat->getSize() != 0) { + + // Mmap the response file into memory. + OwningPtr<MemoryBuffer> + respFilePtr(MemoryBuffer::getFile(respFile.c_str())); + + // If we could open the file, parse its contents, otherwise + // pass the @file option verbatim. + // TODO: support recursion. + if (respFilePtr != 0) { + ParseCStringVector(newArgv, respFilePtr->getBufferStart()); + continue; + } + } } + newArgv.push_back(strdup(arg)); } } |

