[clang] [analyzer] Fix checker message order in the program state dump (PR #235091)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 26 03:33:08 PDT 2026


================
@@ -858,11 +858,21 @@ void CheckerManager::runCheckersForPrintStateJson(raw_ostream &Out,
   ++Space;
   bool HasMessage = false;
 
-  // Store the last CheckerTag.
-  const void *LastCT = nullptr;
+  std::vector<CheckerBackend *> CheckerBackends;
   for (const auto &CT : CheckerTags) {
+    CheckerBackend *CB = CT.second.get();
+    CheckerBackends.push_back(CB);
+  }
+  llvm::sort(CheckerBackends,
+             [](const CheckerBackend *First, const CheckerBackend *Last) {
+               return First->getDebugTag() < Last->getDebugTag();
----------------
NagyDonat wrote:

What is the reason for picking the variable names `First` and `Last` here? Is this some established pattern? If not, then I'd prefer some clearly meaningless names (e.g. `X` and `Y`), because these made me think if there is some meaning behind them.

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


More information about the cfe-commits mailing list