[clang] [clang][analyzer] Make per-entry-point metric rows uniquely identifiable (PR #161663)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 3 06:19:29 PDT 2025


================
@@ -65,6 +65,15 @@ STAT_MAX(MaxCFGSize, "The maximum number of basic blocks in a function.");
 
 namespace {
 
+StringRef getMainFileName(const CompilerInvocation &Invocation) {
+  if (!Invocation.getFrontendOpts().Inputs.empty()) {
+    const FrontendInputFile &Input = Invocation.getFrontendOpts().Inputs[0];
+    return Input.isFile() ? Input.getFile()
+                          : Input.getBuffer().getBufferIdentifier();
+  }
+  return {};
----------------
NagyDonat wrote:

What about returning a human-readable placeholder like `"<no input>"` in this case? I would guess that it would be more helpful (e.g. easier to search for) if someone runs into this rare corner case.

https://github.com/llvm/llvm-project/pull/161663


More information about the cfe-commits mailing list