[clang] [NFC][analyzer] Clarify that ExplodedGraph has only one roots (PR #139903)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed May 14 07:13:15 PDT 2025


================
@@ -46,8 +46,9 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G,
   llvm::SmallPtrSet<const CFGBlock*, 32> reachable;
 
   // Root node should have the location context of the top most function.
-  const ExplodedNode *GraphRoot = *G.roots_begin();
-  const LocationContext *LC = GraphRoot->getLocation().getLocationContext();
+  // FIXME: Use `Eng.getRootLocationContext()` unless `G` can be different from
+  // the `ExplodedGraph` owned by Eng.
+  const LocationContext *LC = G.getRoot()->getLocation().getLocationContext();
----------------
steakhal wrote:

I think what you suggest here would make sense. At this callback this graph must be owned by Eng.

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


More information about the cfe-commits mailing list