[PATCH] D137751: Produce a more informative diagnostics when Clang runs out of source locations

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 15:55:24 PST 2022


rsmith created this revision.
rsmith added a reviewer: aaron.ballman.
Herald added a subscriber: mgrang.
Herald added a project: All.
rsmith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

If Clang runs out of source location address space, produce a more helpful diagnostic than "ran out of source locations" or "translation unit is too large". In addition to that diagnostic, also describe the current source location address space usage, listing the header files that are contributing most to that as well as how many times they were textually entered. The intent is to make it easier to determine if the problem is some kind of misconfiguration (for example, a header isn't properly include-guarded and gets textually entered a lot, or is entered in many AST files), problematic input (for example, a preprocessor metaprogram uses a huge amount of source location space), or a death by a thousand cuts due to the source program just plain being too large.

Also included is a debug pragma to produce the usage report, both to make this more readily testable and to provide visibility into source location address space usage when debugging clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137751

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Basic/SourceManager.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/Misc/Inputs/include.h
  clang/test/Misc/sloc-usage.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137751.474383.patch
Type: text/x-patch
Size: 10891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221109/faec6160/attachment.bin>


More information about the cfe-commits mailing list