[clang] [analyzer] Detect leaks of stack addresses via output params, indirect globals 3/3 (PR #105648)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 02:06:40 PDT 2024


================
@@ -305,6 +305,14 @@ static const MemSpaceRegion *getStackOrGlobalSpaceRegion(const MemRegion *R) {
   return nullptr;
 }
 
+const MemRegion *getOriginBaseRegion(const MemRegion *Referrer) {
+  Referrer = Referrer->getBaseRegion();
+  while (const auto *SymReg = dyn_cast<SymbolicRegion>(Referrer)) {
+    Referrer = SymReg->getSymbol()->getOriginRegion()->getBaseRegion();
+  }
+  return Referrer;
----------------
NagyDonat wrote:

`<bikeshedding>`
Consider replacing `Referrer` with a more generic variable name like `MR` or `Region` or `Reg`, as this is a generic region -> region transformation.
`</bikeshedding>`

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


More information about the cfe-commits mailing list