Statistic: Only print statistics on exit for -stats
authorMatthias Braun <matze@braunis.de>
Mon, 26 Sep 2016 18:38:07 +0000 (18:38 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 26 Sep 2016 18:38:07 +0000 (18:38 +0000)
commitc603551b4e61ad58589e4d34cd7de69420fd7081
treef1e7bcc2ade852a1ef4ea4eda43c1ab46ce2a0be
parent3de0791144be11b7121478f78dda9e35dedb6d0b
Statistic: Only print statistics on exit for -stats

Previously enabling the statistics with EnableStatistics() would lead to
them getting printed to stderr/-info-output-file on exit. However
frontends may want a way to enable statistics and do the printing on
their own instead of the forced printing on exit.

This changes the code so that only the -stats option enables printing on
exit, EnableStatistics() only enables the tracking but requires invoking
one of the PrintStatistics() variants.

Differential Revision: https://reviews.llvm.org/D24819

llvm-svn: 282425
llvm/lib/Support/Statistic.cpp