[PATCH] D21008: Create version.txt in a reproduce archive file.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 08:41:21 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271901: Create version.txt in a reproduce archive file. (authored by ruiu).
Changed prior to commit:
http://reviews.llvm.org/D21008?vs=59681&id=59729#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21008
Files:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Driver.h
lld/trunk/ELF/DriverUtils.cpp
lld/trunk/test/ELF/reproduce.s
Index: lld/trunk/test/ELF/reproduce.s
===================================================================
--- lld/trunk/test/ELF/reproduce.s
+++ lld/trunk/test/ELF/reproduce.s
@@ -19,6 +19,9 @@
# RSP-NEXT: -shared
# RSP-NEXT: --as-needed
+# RUN: FileCheck %s --check-prefix=VERSION < repro/version.txt
+# VERSION: LLD
+
# RUN: mkdir -p %t.dir/build2/a/b/c
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o
# RUN: cd %t.dir/build2/a/b/c
@@ -50,6 +53,7 @@
# RUN: cpio -t < repro2.cpio | FileCheck %s
# CHECK: repro2/response.txt
+# CHECK-NEXT: repro2/version.txt
# CHECK-NEXT: repro2/{{.*}}/dyn
# CHECK-NEXT: repro2/{{.*}}/ver
# CHECK-NEXT: repro2/{{.*}}/foo bar
Index: lld/trunk/ELF/DriverUtils.cpp
===================================================================
--- lld/trunk/ELF/DriverUtils.cpp
+++ lld/trunk/ELF/DriverUtils.cpp
@@ -80,12 +80,12 @@
Table.PrintHelp(outs(), Argv0, "lld", false);
}
-void elf::printVersion() {
- outs() << "LLD " << getLLDVersion();
- std::string S = getLLDRepositoryVersion();
- if (!S.empty())
- outs() << " " << S;
- outs() << "\n";
+std::string elf::getVersionString() {
+ std::string Version = getLLDVersion();
+ std::string Repo = getLLDRepositoryVersion();
+ if (Repo.empty())
+ return "LLD " + Version + "\n";
+ return "LLD " + Version + " " + Repo + "\n";
}
// Converts a hex string (e.g. "0x123456") to a vector.
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -248,16 +248,18 @@
return;
}
if (Args.hasArg(OPT_version)) {
- printVersion();
+ outs() << getVersionString();
return;
}
if (auto *Arg = Args.getLastArg(OPT_reproduce)) {
// Note that --reproduce is a debug option so you can ignore it
// if you are trying to understand the whole picture of the code.
Cpio.reset(CpioFile::create(Arg->getValue()));
- if (Cpio)
+ if (Cpio) {
Cpio->append("response.txt", createResponseFile(Args));
+ Cpio->append("version.txt", getVersionString());
+ }
}
readConfigs(Args);
Index: lld/trunk/ELF/Driver.h
===================================================================
--- lld/trunk/ELF/Driver.h
+++ lld/trunk/ELF/Driver.h
@@ -95,7 +95,7 @@
};
void printHelp(const char *Argv0);
-void printVersion();
+std::string getVersionString();
std::vector<uint8_t> parseHexstring(StringRef S);
std::string createResponseFile(const llvm::opt::InputArgList &Args);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21008.59729.patch
Type: text/x-patch
Size: 2567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/a9f902a3/attachment.bin>
More information about the llvm-commits
mailing list