Skip to content

Commit 1ca85b3

Browse files
committed
[llvm-bcanalyzer] Don't dump the contents if -dump is not passed
With all the previous refactorings this slipped through and now we always dump the contents of the bitcode files, even if -dump is not passed.
1 parent 7313d7d commit 1ca85b3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
RUN: llvm-bcanalyzer -dump %S/Inputs/has-block-info.bc | FileCheck -check-prefix=WITH-DUMP %s
2+
RUN: llvm-bcanalyzer %S/Inputs/has-block-info.bc | FileCheck -check-prefix=WITHOUT-DUMP %s
3+
4+
WITH-DUMP: <ABC
5+
WITHOUT-DUMP-NOT: <ABC
6+
WITH-DUMP: </ABC>
7+
WITHOUT-DUMP-NOT: </ABC>
8+
WITH-DUMP: <XYZ
9+
WITHOUT-DUMP-NOT: <XYZ
10+
WITH-DUMP: </XYZ>
11+
WITHOUT-DUMP-NOT: </XYZ>

llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ int main(int argc, char **argv) {
102102
O.Symbolic = !NonSymbolic;
103103
O.ShowBinaryBlobs = ShowBinaryBlobs;
104104

105-
ExitOnErr(
106-
BA.analyze(O, CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
105+
ExitOnErr(BA.analyze(
106+
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(None),
107+
CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
107108

108109
if (Dump)
109110
outs() << "\n\n";

0 commit comments

Comments
 (0)