[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
Tue Jan 14 07:24:47 PST 2020


hans created this revision.
hans added reviewers: thakis, rnk, rsmith.

See https://docs.google.com/document/d/1xMkTZMKx9llnMPgso0jrx3ankI4cv60xeZ0y4ksf4wc/preview for background discussion.

This adds a warning, flags and pragmas to limit the number of pre-processor tokens either at a certain point in a translation unit, or overall.

The idea is that this would allow projects to limit the size of certain widely included headers, or for translation units overall, as a way to insert backstops for header bloat and prevent compile-time regressions.

What do you think?


https://reviews.llvm.org/D72703

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/Preprocessor.h
  clang/include/clang/Parse/Parser.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Parse/Parser.cpp
  clang/test/Driver/autocomplete.c
  clang/test/Parser/max-tokens.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72703.237971.patch
Type: text/x-patch
Size: 14156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200114/05d63878/attachment-0001.bin>


More information about the cfe-commits mailing list