[PATCH] D72703: Add a warning, flags and pragmas to limit the number of pre-processor tokens in a translation unit

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 09:09:14 PST 2020


hans added a comment.

In D72703#1833018 <https://reviews.llvm.org/D72703#1833018>, @kimgr wrote:

> I just want to say that finding the correlation between token count and compile time is a bit of a breakthrough!


I assume the same correlation could also be found with lines of code, but I think tokens is a better dimension to measure since it's less likely to be gamed, and it also is also kind of the basic work unit that the compiler deals with.

> Could you expose a flag for printing token count so users can run their own analysis? Or does that already exist in baseline clang? It's easier to set a maximum for a codebase if the distribution is known.

I used this patch with -fmax-tokens 1 and scraped the output for my measurements. I would like to avoid adding a separate flag if we can avoid it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72703/new/

https://reviews.llvm.org/D72703





More information about the cfe-commits mailing list