<div dir="ltr"><div>Unfortunately, I think that this now breaks for multi-config generators (sadly, I don't think we have any public buildbots building using these).  I've tried it on Windows with cmake -G "Visual Studio 14 2015 Win64", but I'd guess the same thing would happen with cmake -G "Xcode".  If I build "Debug" I get a whole bunch of check-all failures along the lines of:</div><div><br></div><div>  # command stderr:</div><div>  C:\work\public-git\upstream-llvm\llvm\tools\clang\test\Analysis\stats.c:7:11: error: expected string not found in input</div><div><br></div><div>  // CHECK: ... Statistics Collected ...</div><div><br></div><div>            ^</div><div><br></div><div>  <stdin>:1:1: note: scanning from here</div><div><br></div><div><br></div><div>The issue basically comes down to the fact that with a multi-config generator, it's not actually known at CMake time whether LLVM_ENABLE_ASSERTIONS is true or not, as the IDE will let the user decide whether to build Debug or Release from the already generated project at build time.  I assume this is why we had all those checks on NDEBUG at the same time as LLVM_ENABLE_STATS previously.</div><div><br></div><div>-Greg</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 March 2018 at 19:38, Daniel Sanders via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dsanders<br>
Date: Mon Mar  5 11:38:16 2018<br>
New Revision: 326738<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=326738&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=326738&view=rev</a><br>
Log:<br>
Re-commit: Make STATISTIC() values available programmatically<br>
<br>
Summary:<br>
It can be useful for tools to be able to retrieve the values of variables<br>
declared via STATISTIC() directly without having to emit them and parse<br>
them back. Use cases include:<br>
* Needing to report specific statistics to a test harness<br>
* Wanting to post-process statistics. For example, to produce a percentage of<br>
  functions that were fully selected by GlobalISel<br>
<br>
Make this possible by adding llvm::GetStatistics() which returns an<br>
iterator_range that can be used to inspect the statistics that have been<br>
touched during execution. When statistics are disabled (NDEBUG and not<br>
LLVM_ENABLE_STATISTICS) this method will return an empty range.<br>
<br>
This patch doesn't address the effect of multiple compilations within the same<br>
process. In such situations, the statistics will be cumulative for all<br>
compilations up to the GetStatistics() call.<br>
<br>
Reviewers: qcolombet, rtereshin, aditya_nandakumar, bogner<br>
<br>
Reviewed By: rtereshin, bogner<br>
<br>
Subscribers: llvm-commits, mgorny<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D43901" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D43901</a><br>
<br>
This re-commit fixes a missing include of <vector> which it seems clang didn't<br>
mind but G++ and MSVC objected to. It seems that, clang was ok with std::vector<br>
only being forward declared at the point of use since it was fully defined<br>
eventually but G++/MSVC both rejected it at the point of use.<br>
<br>
Added:<br>
    llvm/trunk/unittests/ADT/<wbr>StatisticTest.cpp<br>
      - copied unchanged from r326725, llvm/trunk/unittests/ADT/<wbr>StatisticTest.cpp<br>
Modified:<br>
    llvm/trunk/cmake/modules/<wbr>HandleLLVMOptions.cmake<br>
    llvm/trunk/include/llvm/ADT/<wbr>Statistic.h<br>
    llvm/trunk/include/llvm/<wbr>Config/llvm-config.h.cmake<br>
    llvm/trunk/lib/Support/<wbr>Statistic.cpp<br>
    llvm/trunk/unittests/ADT/<wbr>CMakeLists.txt<br></blockquote></div></div></div>