[PATCH] D136954: DiagnosticInfo: Report function location for resource limits

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 13:01:41 PDT 2022


aeubanks added a comment.

the reason clang tries to handle diagnostics is to be able to actually print the source code as context which is nice. but of course we can't do that without clang so there's a default handler

> If clang prints it, the source location is first followed by "warning". The backend diagnostic, as printed by other tools puts "warning" first.

It looks like the backend diagnostic doesn't even print the location?



================
Comment at: llvm/include/llvm/IR/DiagnosticInfo.h:356
 
+/// Diagnostic information for stack size etc. reporting.
+/// This is basically a function and a size.
----------------
any reason for moving this code? it makes it hard to see the diff


================
Comment at: llvm/lib/IR/DiagnosticInfo.cpp:76
 void DiagnosticInfoResourceLimit::print(DiagnosticPrinter &DP) const {
-  DP << getResourceName() << " (" << getResourceSize() << ") exceeds limit ("
-     << getResourceLimit() << ") in function '" << getFunction() << '\'';
+  DP << getLocationStr() << ": " << getResourceName() << " ("
+     << getResourceSize() << ") exceeds limit (" << getResourceLimit()
----------------
we should guard this with `isLocationAvailable()`, the `<unknown>:0:0` isn't very useful


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

https://reviews.llvm.org/D136954



More information about the llvm-commits mailing list