diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-03-25 20:40:27 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-03-25 20:40:27 +0000 |
| commit | 85093df3bd27256fcad259d4ee16b5e4f894b209 (patch) | |
| tree | 6fb2d57e8cc462a077e7004bac1463599eb2ac4f | |
| parent | 83055ade751b4c3528e07a75b510d96bf9efe4d4 (diff) | |
| download | bcm5719-llvm-85093df3bd27256fcad259d4ee16b5e4f894b209.tar.gz bcm5719-llvm-85093df3bd27256fcad259d4ee16b5e4f894b209.zip | |
[PECOFF] Print out command line if we have expanded response files.
If a response file is given via command line, the final command line
arguments will not appear in the log because the actual arguments are
in the given file.
This patch is to show the final command line if /verbose is specified
to help users.
llvm-svn: 204754
| -rw-r--r-- | lld/lib/Driver/WinLinkDriver.cpp | 18 | ||||
| -rw-r--r-- | lld/test/pecoff/responsefile.test | 3 |
2 files changed, 17 insertions, 4 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index f441034dfed..49a117ad251 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -640,9 +640,9 @@ static bool readResponseFile(StringRef path, PECOFFLinkingContext &ctx, // Expand arguments starting with "@". It's an error if a specified file does // not exist. Returns true on success. static bool expandResponseFiles(int &argc, const char **&argv, - PECOFFLinkingContext &ctx, raw_ostream &diag) { + PECOFFLinkingContext &ctx, raw_ostream &diag, + bool &expanded) { std::vector<const char *> newArgv; - bool expanded = false; for (int i = 0; i < argc; ++i) { if (argv[i][0] != '@') { newArgv.push_back(argv[i]); @@ -669,7 +669,8 @@ static std::unique_ptr<llvm::opt::InputArgList> parseArgs(int argc, const char **argv, PECOFFLinkingContext &ctx, raw_ostream &diag, bool isReadingDirectiveSection) { // Expand arguments starting with "@". - if (!expandResponseFiles(argc, argv, ctx, diag)) + bool expanded = false; + if (!expandResponseFiles(argc, argv, ctx, diag, expanded)) return nullptr; // Parse command line options using WinLinkOptions.td @@ -696,6 +697,17 @@ parseArgs(int argc, const char **argv, PECOFFLinkingContext &ctx, continue; diag << "warning: ignoring unknown argument: " << arg << "\n"; } + + // If we have expaneded response files and /verbose is given, print out the + // final command line. + if (!isReadingDirectiveSection && expanded && + parsedArgs->getLastArg(OPT_verbose)) { + diag << "Command line:"; + for (int i = 0; i < argc; ++i) + diag << " " << argv[i]; + diag << "\n\n"; + } + return parsedArgs; } diff --git a/lld/test/pecoff/responsefile.test b/lld/test/pecoff/responsefile.test index 9732cb37d0e..6a5da298e73 100644 --- a/lld/test/pecoff/responsefile.test +++ b/lld/test/pecoff/responsefile.test @@ -1,6 +1,7 @@ # RUN: yaml2obj %p/Inputs/hello.obj.yaml > %t.obj -# RUN: not lld -flavor link @%p/Inputs/responsefile.txt >& %t.log +# RUN: not lld -flavor link /verbose @%p/Inputs/responsefile.txt >& %t.log # RUN: FileCheck %s < %t.log CHECK: warning: ignoring unknown argument: -foo CHECK: warning: ignoring unknown argument: -bar\baz +Command line: link /verbose -foo -bar\baz |

