summaryrefslogtreecommitdiff
path: root/tools/llvm-strings
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2016-11-14 13:09:24 +0000
committerRenato Golin <renato.golin@linaro.org>2016-11-14 13:09:24 +0000
commitbdeedc78d8c9fa101eab2cc299bb4dae27349115 (patch)
tree355e65e4ce8eb052b9a00232907ee4cebefde34d /tools/llvm-strings
parent7ff5cb157f8667290a51b3f4e16368b67b696f0e (diff)
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
Diffstat (limited to 'tools/llvm-strings')
-rw-r--r--tools/llvm-strings/llvm-strings.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/tools/llvm-strings/llvm-strings.cpp b/tools/llvm-strings/llvm-strings.cpp
index cb0fb9651d9..6e5e2f298c3 100644
--- a/tools/llvm-strings/llvm-strings.cpp
+++ b/tools/llvm-strings/llvm-strings.cpp
@@ -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;