[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.
This commit is contained in:
Francis Visoiu Mistrih 2019-11-13 10:37:14 -08:00
parent 7a21472d38
commit e206b99c28
2 changed files with 14 additions and 2 deletions

View File

@ -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>

View File

@ -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";