ELF2: Support reponse files.

http://reviews.llvm.org/D13148

llvm-svn: 248575
This commit is contained in:
Rui Ueyama
2015-09-25 15:37:33 +00:00
parent d1f06aecc0
commit eeb22f8251
3 changed files with 17 additions and 1 deletions

View File

@@ -16,6 +16,8 @@
#include "Driver.h"
#include "Error.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/StringSaver.h"
using namespace llvm;
@@ -53,7 +55,13 @@ opt::InputArgList ArgParser::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;
opt::InputArgList Args = Table.ParseArgs(Argv, MissingIndex, MissingCount);
// Expand response files. '@<filename>' is replaced by the file's contents.
SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
StringSaver Saver(Alloc);
llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, Vec);
// Parse options and then do error checking.
opt::InputArgList Args = Table.ParseArgs(Vec, MissingIndex, MissingCount);
if (MissingCount)
error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) +
"\", expected " + Twine(MissingCount) +