[clang] Thread Safety Analysis: Improved pointer handling (PR #127396)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 16:56:49 PST 2025


================
@@ -1780,6 +1782,14 @@ void ThreadSafetyAnalyzer::checkPtAccess(const FactSet &FSet, const Expr *Exp,
       Exp = CE->getSubExpr();
       continue;
     }
+    if (const auto *UO = dyn_cast<UnaryOperator>(Exp)) {
+      if (UO->getOpcode() == UO_AddrOf) {
+        // Pointer access via pointer taken of variable, so the dereferenced
+        // variable is not actually a pointer.
+        checkAccess(FSet, UO->getSubExpr(), AK, POK);
+        return;
+      }
+    }
----------------
aaronpuchert wrote:

This should probably be after the loop, similar to `checkAccess`.

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


More information about the cfe-commits mailing list