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

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 04:50:46 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 =
+      (*G.roots_begin())->getLocation().getLocationContext();
+
+  if (CalleeLC->getStackFrame() == RootLC->getStackFrame())
+    return nullptr;
+
+  return CalleeLC;
+}
----------------
balazs-benics-sonarsource wrote:

~~Is this basically the getStackFrame's parent's getStackFrame?~~
No, you are right. There may be some other location context above the Stack frame context of the parent frame.

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


More information about the cfe-commits mailing list