Skip to content

Commit

Permalink
[llvm-bcanalyzer] Don't dump the contents if -dump is not passed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
francisvm committed Nov 13, 2019
1 parent 7313d7d commit 1ca85b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions llvm/test/Other/bcanalyzer-dump-option.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RUN: llvm-bcanalyzer -dump %S/Inputs/has-block-info.bc | FileCheck -check-prefix=WITH-DUMP %s
RUN: llvm-bcanalyzer %S/Inputs/has-block-info.bc | FileCheck -check-prefix=WITHOUT-DUMP %s

WITH-DUMP: <ABC
WITHOUT-DUMP-NOT: <ABC
WITH-DUMP: </ABC>
WITHOUT-DUMP-NOT: </ABC>
WITH-DUMP: <XYZ
WITHOUT-DUMP-NOT: <XYZ
WITH-DUMP: </XYZ>
WITHOUT-DUMP-NOT: </XYZ>
5 changes: 3 additions & 2 deletions llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ int main(int argc, char **argv) {
O.Symbolic = !NonSymbolic;
O.ShowBinaryBlobs = ShowBinaryBlobs;

ExitOnErr(
BA.analyze(O, CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
ExitOnErr(BA.analyze(
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(None),
CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));

if (Dump)
outs() << "\n\n";
Expand Down

0 comments on commit 1ca85b3

Please sign in to comment.