================
@@ -800,6 +800,50 @@ static bool isNullTermPointer(const Expr *Ptr, ASTContext
&Ctx) {
return false;
}
+// Given an expression like `&x` or `std::addressof(x)`, returns the
+// `DeclRefExpr` corresponding to `x`. Returns null if the expression `E` is
not
+// an address-of expression.
+static const DeclRefExpr *getDeclRefInAddressOfExpr(const Expr *E) {
----------------
rohanjr wrote:
It seems your comment is still valid, i.e. we could use the helper function to
look for an address-of expression. I refactored the helper so it can be used
easily in `IsPtrBufferSafe` (see last commit), but I think the change to
`isPtrBufferSafe` should be in a separate PR in case it accidentally changes
behavior / needs to be rolled back.
https://github.com/llvm/llvm-project/pull/178107
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits