diff options
author | Rui Ueyama <ruiu@google.com> | 2016-05-04 23:12:55 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-05-04 23:12:55 +0000 |
commit | af2312feb761f55afdb3c809917488d44b61c6f2 (patch) | |
tree | f7c6eefafe4d13fb8aaf70a50b2ed3d981d396e8 | |
parent | fc1214fee2f608f4d593a0514cc173ee60137240 (diff) | |
download | bcm5719-llvm-af2312feb761f55afdb3c809917488d44b61c6f2.tar.gz bcm5719-llvm-af2312feb761f55afdb3c809917488d44b61c6f2.zip |
Make --reproduce to not produce undesired whitespace.
Fixes bug 27648.
llvm-svn: 268569
-rw-r--r-- | lld/ELF/DriverUtils.cpp | 16 | ||||
-rw-r--r-- | lld/test/ELF/reproduce.s | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp index 179b8b79caf..23e3ac12ac6 100644 --- a/lld/ELF/DriverUtils.cpp +++ b/lld/ELF/DriverUtils.cpp @@ -17,6 +17,7 @@ #include "Error.h" #include "lld/Config/Version.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Option/Option.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" @@ -173,6 +174,16 @@ static std::string rewritePath(StringRef S) { return S; } +static std::string stringize(opt::Arg *Arg) { + std::string K = Arg->getSpelling(); + if (Arg->getNumValues() == 0) + return K; + std::string V = quote(Arg->getValue()); + if (Arg->getOption().getRenderStyle() == opt::Option::RenderJoinedStyle) + return K + V; + return K + " " + V; +} + // Copies all input files to Config->Reproduce directory and // create a response file as "response.txt", so that you can re-run // the same command with the same inputs just by executing @@ -198,10 +209,7 @@ void elf::createResponseFile(const opt::InputArgList &Args) { << quote(rewritePath(Arg->getValue())) << "\n"; break; default: - OS << Arg->getSpelling(); - if (Arg->getNumValues() > 0) - OS << " " << quote(Arg->getValue()); - OS << "\n"; + OS << stringize(Arg) << "\n"; } } diff --git a/lld/test/ELF/reproduce.s b/lld/test/ELF/reproduce.s index 9c01bfce425..116c02fa4fc 100644 --- a/lld/test/ELF/reproduce.s +++ b/lld/test/ELF/reproduce.s @@ -32,7 +32,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar' # RUN: ld.lld --reproduce repro2 'foo bar' -L"foo bar" -Lfile \ # RUN: --dynamic-list dyn -rpath file --script file --version-script ver \ -# RUN: --dynamic-linker "some unusual/path" +# RUN: --dynamic-linker "some unusual/path" -soname 'foo bar' -soname='foo bar' # RUN: cpio -id < repro2.cpio # RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt # RSP2: "{{.*}}foo bar" @@ -43,6 +43,8 @@ # RSP2-NEXT: --script {{.+}}file # RSP2-NEXT: --version-script {{.+}}ver # RSP2-NEXT: --dynamic-linker "some unusual/path" +# RSP2-NEXT: -soname="foo bar" +# RSP2-NEXT: -soname="foo bar" .globl _start _start: |