<p dir="ltr">Lgtm. Thanks!</p>
<div class="gmail_quote">On Jun 5, 2016 8:43 PM, "Rui Ueyama" <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ruiu created this revision.<br>
ruiu added a reviewer: rafael.<br>
ruiu added a subscriber: llvm-commits.<br>
<br>
Create version.txt in a reproduce archive file.<br>
<br>
<a href="http://reviews.llvm.org/D21008" rel="noreferrer" target="_blank">http://reviews.llvm.org/D21008</a><br>
<br>
Files:<br>
ELF/Driver.cpp<br>
ELF/Driver.h<br>
ELF/DriverUtils.cpp<br>
test/ELF/reproduce.s<br>
<br>
Index: test/ELF/reproduce.s<br>
===================================================================<br>
--- test/ELF/reproduce.s<br>
+++ test/ELF/reproduce.s<br>
@@ -19,6 +19,9 @@<br>
# RSP-NEXT: -shared<br>
# RSP-NEXT: --as-needed<br>
<br>
+# RUN: FileCheck %s --check-prefix=VERSION < repro/version.txt<br>
+# VERSION: LLD<br>
+<br>
# RUN: mkdir -p %t.dir/build2/a/b/c<br>
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o<br>
# RUN: cd %t.dir/build2/a/b/c<br>
@@ -50,6 +53,7 @@<br>
<br>
# RUN: cpio -t < repro2.cpio | FileCheck %s<br>
# CHECK: repro2/response.txt<br>
+# CHECK-NEXT: repro2/version.txt<br>
# CHECK-NEXT: repro2/{{.*}}/dyn<br>
# CHECK-NEXT: repro2/{{.*}}/ver<br>
# CHECK-NEXT: repro2/{{.*}}/foo bar<br>
Index: ELF/DriverUtils.cpp<br>
===================================================================<br>
--- ELF/DriverUtils.cpp<br>
+++ ELF/DriverUtils.cpp<br>
@@ -80,12 +80,12 @@<br>
Table.PrintHelp(outs(), Argv0, "lld", false);<br>
}<br>
<br>
-void elf::printVersion() {<br>
- outs() << "LLD " << getLLDVersion();<br>
- std::string S = getLLDRepositoryVersion();<br>
- if (!S.empty())<br>
- outs() << " " << S;<br>
- outs() << "\n";<br>
+std::string elf::getVersionString() {<br>
+ std::string Version = getLLDVersion();<br>
+ std::string Repo = getLLDRepositoryVersion();<br>
+ if (Repo.empty())<br>
+ return "LLD " + Version + "\n";<br>
+ return "LLD " + Version + " " + Repo + "\n";<br>
}<br>
<br>
// Converts a hex string (e.g. "0x123456") to a vector.<br>
Index: ELF/Driver.h<br>
===================================================================<br>
--- ELF/Driver.h<br>
+++ ELF/Driver.h<br>
@@ -95,7 +95,7 @@<br>
};<br>
<br>
void printHelp(const char *Argv0);<br>
-void printVersion();<br>
+std::string getVersionString();<br>
std::vector<uint8_t> parseHexstring(StringRef S);<br>
<br>
std::string createResponseFile(const llvm::opt::InputArgList &Args);<br>
Index: ELF/Driver.cpp<br>
===================================================================<br>
--- ELF/Driver.cpp<br>
+++ ELF/Driver.cpp<br>
@@ -248,16 +248,18 @@<br>
return;<br>
}<br>
if (Args.hasArg(OPT_version)) {<br>
- printVersion();<br>
+ outs() << getVersionString();<br>
return;<br>
}<br>
<br>
if (auto *Arg = Args.getLastArg(OPT_reproduce)) {<br>
// Note that --reproduce is a debug option so you can ignore it<br>
// if you are trying to understand the whole picture of the code.<br>
Cpio.reset(CpioFile::create(Arg->getValue()));<br>
- if (Cpio)<br>
+ if (Cpio) {<br>
Cpio->append("response.txt", createResponseFile(Args));<br>
+ Cpio->append("version.txt", getVersionString());<br>
+ }<br>
}<br>
<br>
readConfigs(Args);<br>
<br>
<br>
</blockquote></div>