mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
Revert "llvm-strings: support printing the filename"
Also, Revert "test: remove the archive before modifying it" Revert "test: explicitly use gnu format" This reverts commits r286778, r286729 and r286767, as they are randomly failing on many bots (AArch64, x86_64). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286820 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
RUN: echo -n abcd > %T/abcd
|
||||
RUN: rm -f %T/archive.a
|
||||
RUN: llvm-ar -format gnu crs %T/archive.a %T/abcd
|
||||
RUN: llvm-strings -f %T/archive.a | FileCheck %s
|
||||
RUN: llvm-strings --print-file-name %T/archive.a | FileCheck %s
|
||||
|
||||
CHECK: archive.a: !<arch>
|
||||
CHECK: archive.a: abcd/ 0 0 0 644 4 `
|
||||
CHECK: archive.a: abcd
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
RUN: echo -n abcd > %T/abcd
|
||||
RUN: llvm-strings -f %T/abcd | FileCheck %s
|
||||
RUN: llvm-strings --print-file-name %T/abcd | FileCheck %s
|
||||
CHECK: {{[\\/]}}abcd: abcd
|
||||
@@ -1,8 +1,8 @@
|
||||
RUN: echo -n abcd > %T/abcd
|
||||
RUN: rm -f %T/inner.ar
|
||||
RUN: llvm-ar -format gnu crs %T/inner.a %T/abcd
|
||||
RUN: llvm-ar crs %T/inner.a %T/abcd
|
||||
RUN: rm -f %T/outer.ar
|
||||
RUN: llvm-ar -format gnu crs %T/outer.a %T/inner.a
|
||||
RUN: llvm-ar crs %T/outer.a %T/inner.a
|
||||
RUN: llvm-strings %T/outer.a | FileCheck %s
|
||||
|
||||
CHECK: !<arch>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
RUN: echo -n abcd | llvm-strings -f - | FileCheck %s
|
||||
RUN: echo -n abcd | llvm-strings --print-file-name - | FileCheck %s
|
||||
CHECK: {standard input}: abcd
|
||||
@@ -29,19 +29,7 @@ static cl::list<std::string> InputFileNames(cl::Positional,
|
||||
cl::desc("<input object files>"),
|
||||
cl::ZeroOrMore);
|
||||
|
||||
static cl::opt<bool>
|
||||
PrintFileName("print-file-name",
|
||||
cl::desc("Print the name of the file before each string"));
|
||||
static cl::alias PrintFileNameShort("f", cl::desc(""),
|
||||
cl::aliasopt(PrintFileName));
|
||||
|
||||
static void strings(raw_ostream &OS, StringRef FileName, StringRef Contents) {
|
||||
auto print = [&OS, FileName](StringRef L) {
|
||||
if (PrintFileName)
|
||||
OS << FileName << ": ";
|
||||
OS << L << '\n';
|
||||
};
|
||||
|
||||
static void strings(raw_ostream &OS, StringRef Contents) {
|
||||
const char *P = nullptr, *E = nullptr, *S = nullptr;
|
||||
for (P = Contents.begin(), E = Contents.end(); P < E; ++P) {
|
||||
if (std::isgraph(*P) || std::isblank(*P)) {
|
||||
@@ -49,12 +37,12 @@ static void strings(raw_ostream &OS, StringRef FileName, StringRef Contents) {
|
||||
S = P;
|
||||
} else if (S) {
|
||||
if (P - S > 3)
|
||||
print(StringRef(S, P - S));
|
||||
OS << StringRef(S, P - S) << '\n';
|
||||
S = nullptr;
|
||||
}
|
||||
}
|
||||
if (S && E - S > 3)
|
||||
print(StringRef(S, E - S));
|
||||
OS << StringRef(S, E - S) << '\n';
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -72,8 +60,7 @@ int main(int argc, char **argv) {
|
||||
if (std::error_code EC = Buffer.getError())
|
||||
errs() << File << ": " << EC.message() << '\n';
|
||||
else
|
||||
strings(llvm::outs(), File == "-" ? "{standard input}" : File,
|
||||
Buffer.get()->getMemBufferRef().getBuffer());
|
||||
strings(llvm::outs(), Buffer.get()->getMemBufferRef().getBuffer());
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user