[clang] [analyzer] Workaround for slowdown spikes (unintended scope increase) (PR #136720)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 05:07:48 PDT 2025


================
@@ -2523,6 +2523,20 @@ bool ExprEngine::replayWithoutInlining(ExplodedNode *N,
   return true;
 }
 
+/// Return the innermost location context which is inlined at `Node`, unless
+/// it's the top-level (entry point) location context.
+static const LocationContext *getInlinedLocationContext(ExplodedNode *Node,
+                                                        ExplodedGraph &G) {
+  const LocationContext *CalleeLC = Node->getLocation().getLocationContext();
+  const LocationContext *RootLC =
----------------
NagyDonat wrote:

I surveyed references to the root nodes of the graph and it seems that the analyzer doesn't create more than one root node within a single `ExplodedGraph` (it does create new root node in a new graph when it creates the trimmed graph for a bug report) and most locations that reference `roots_begin` work with the assumption that there is only a single root node.

To avoid this sort of confusion in the future, I think it would be useful to replace `std::vector<ExplodedNode *> Roots` with a single `ExplodedNode *Root` within a separate follow-up commit.

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


More information about the cfe-commits mailing list