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

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 16:13:13 PST 2020


rnk added a comment.

I waited to see if there was any other feedback, but I'm in favor of this.

Should we try to come up with better pragma names? `clang max_tokens` doesn't seem to call to mind what it does: warn if there have been more than this many tokens so far in the translation unit. `max_file_tokens` has to do with the number of tokens in the translation unit overall, but it uses the terminology "file" instead of "translation unit". The user could interpret that as being in the current source file, ignoring includes.

Some ideas for the immediate version:

- clang max_tokens_so_far
- clang max_tokens_lexed
- clang max_tokens_here

Some ideas for end-of-tu:

- clang max_translation_unit_tokens
- clang max_tu_tokens
- clang global_max_tokens


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

https://reviews.llvm.org/D72703





More information about the cfe-commits mailing list