[lld] r268569 - Make --reproduce to not produce undesired whitespace.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 16:12:55 PDT 2016
Author: ruiu
Date: Wed May 4 18:12:55 2016
New Revision: 268569
URL: http://llvm.org/viewvc/llvm-project?rev=268569&view=rev
Log:
Make --reproduce to not produce undesired whitespace.
Fixes bug 27648.
Modified:
lld/trunk/ELF/DriverUtils.cpp
lld/trunk/test/ELF/reproduce.s
Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=268569&r1=268568&r2=268569&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Wed May 4 18:12:55 2016
@@ -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
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::
<< quote(rewritePath(Arg->getValue())) << "\n";
break;
default:
- OS << Arg->getSpelling();
- if (Arg->getNumValues() > 0)
- OS << " " << quote(Arg->getValue());
- OS << "\n";
+ OS << stringize(Arg) << "\n";
}
}
Modified: lld/trunk/test/ELF/reproduce.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce.s?rev=268569&r1=268568&r2=268569&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce.s (original)
+++ lld/trunk/test/ELF/reproduce.s Wed May 4 18:12:55 2016
@@ -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:
More information about the llvm-commits
mailing list