Skip to content

Commit 199b6b9

Browse files
committed
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). llvm-svn: 286820
1 parent 2a1cc58 commit 199b6b9

File tree

5 files changed

+6
-36
lines changed

5 files changed

+6
-36
lines changed

llvm/test/tools/llvm-strings/archive-filename.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

llvm/test/tools/llvm-strings/file-filename.test

Lines changed: 0 additions & 4 deletions
This file was deleted.

llvm/test/tools/llvm-strings/nested-archives.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
RUN: echo -n abcd > %T/abcd
22
RUN: rm -f %T/inner.ar
3-
RUN: llvm-ar -format gnu crs %T/inner.a %T/abcd
3+
RUN: llvm-ar crs %T/inner.a %T/abcd
44
RUN: rm -f %T/outer.ar
5-
RUN: llvm-ar -format gnu crs %T/outer.a %T/inner.a
5+
RUN: llvm-ar crs %T/outer.a %T/inner.a
66
RUN: llvm-strings %T/outer.a | FileCheck %s
77

88
CHECK: !<arch>

llvm/test/tools/llvm-strings/stdin-filename.test

Lines changed: 0 additions & 3 deletions
This file was deleted.

llvm/tools/llvm-strings/llvm-strings.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,20 @@ static cl::list<std::string> InputFileNames(cl::Positional,
2929
cl::desc("<input object files>"),
3030
cl::ZeroOrMore);
3131

32-
static cl::opt<bool>
33-
PrintFileName("print-file-name",
34-
cl::desc("Print the name of the file before each string"));
35-
static cl::alias PrintFileNameShort("f", cl::desc(""),
36-
cl::aliasopt(PrintFileName));
37-
38-
static void strings(raw_ostream &OS, StringRef FileName, StringRef Contents) {
39-
auto print = [&OS, FileName](StringRef L) {
40-
if (PrintFileName)
41-
OS << FileName << ": ";
42-
OS << L << '\n';
43-
};
44-
32+
static void strings(raw_ostream &OS, StringRef Contents) {
4533
const char *P = nullptr, *E = nullptr, *S = nullptr;
4634
for (P = Contents.begin(), E = Contents.end(); P < E; ++P) {
4735
if (std::isgraph(*P) || std::isblank(*P)) {
4836
if (S == nullptr)
4937
S = P;
5038
} else if (S) {
5139
if (P - S > 3)
52-
print(StringRef(S, P - S));
40+
OS << StringRef(S, P - S) << '\n';
5341
S = nullptr;
5442
}
5543
}
5644
if (S && E - S > 3)
57-
print(StringRef(S, E - S));
45+
OS << StringRef(S, E - S) << '\n';
5846
}
5947

6048
int main(int argc, char **argv) {
@@ -72,8 +60,7 @@ int main(int argc, char **argv) {
7260
if (std::error_code EC = Buffer.getError())
7361
errs() << File << ": " << EC.message() << '\n';
7462
else
75-
strings(llvm::outs(), File == "-" ? "{standard input}" : File,
76-
Buffer.get()->getMemBufferRef().getBuffer());
63+
strings(llvm::outs(), Buffer.get()->getMemBufferRef().getBuffer());
7764
}
7865

7966
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)