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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 03:48:25 PST 2022


alexfh added a comment.

Thanks for adding this diagnostic! I wonder whether we can include SLoc usage information into `-print-stats` output?



================
Comment at: clang/lib/Basic/SourceManager.cpp:2251
+  uint64_t CountedSize = 0;
+  for (int IDIndex = -(int)LoadedSLocEntryTable.size() - 1;
+       IDIndex < (int)LocalSLocEntryTable.size(); ++IDIndex) {
----------------
Could you add a comment about the meaning of negative IDIndex values?


================
Comment at: clang/test/Lexer/SourceLocationsOverflow.c:7
+// CHECK-NEXT: note: 214{{.......}}B in local locations, 0B in locations loaded from AST files, for a total of 214{{.......}}B (99% of available space)
+// CHECK-NEXT: /usr/local/google/home/richardsmith/llvm-mono-1/src/clang/test/Lexer/Inputs/inc2.h:1:1: note: file entered 214{{..}} times using 214{{.......}}B of space
+// CHECK-NEXT: /*.................................................................................................
----------------
You probably didn't mean to match local paths on your machine. Same below.


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

https://reviews.llvm.org/D137751



More information about the cfe-commits mailing list