[PATCH] D115716: [Analyzer][BugReporter] Replace the example bug report with the one used to generate PathDiagnostic

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 10:00:12 PST 2022


Szelethus added a comment.

First off, your patch is great, and I'm pretty sure we want it!

I remember working around here, and I either have never quite understood what makes `exampleReport` an example, or have long forgotten. Can we not just rename it to `chosenReport`, or simply `report`?



================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:3068-3078
+  const BugReport *report = findReportInEquivalenceClass(EQ, bugReports);
   if (!report)
     return;
 
   // See whether we need to silence the checker/package.
   for (const std::string &CheckerOrPackage :
        getAnalyzerOptions().SilencedCheckersAndPackages) {
----------------
Wouldn't it make more sense to create initialize (instead of resetting) `report` at the call to `generateDiagnosticForConsumerMap()`? This just looks a bit convoluted. We could turn everything up to that point into a [[https://llvm.org/docs/CodingStandards.html#turn-predicate-loops-into-predicate-functions | predicate function]].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115716



More information about the cfe-commits mailing list