================
@@ -458,6 +458,46 @@ static bool areEqualIntegers(const Expr *E1, const Expr 
*E2, ASTContext &Ctx) {
   }
 }
 
+// Given an expression like `&X` or `std::addressof(X)`, returns the `Expr`
+// corresponding to `X` (after removing parens and implicit casts).
+// Returns null if the input expression `E` is not an address-of expression.
+static const Expr *getSubExprInAddressOfExpr(const Expr &E) {
----------------
rohanjr wrote:

I made it a reference to codify the assumption that `E` is not null. (The 
previous versions of these functions dereference the pointer without a check.) 
This is a positive in my mind, and there are other uses of reference parameters 
such as for `ASTContext`.

I do see that most of the AST nodes are passed around by pointers, so if you 
feel this is more important I don't mind changing it back to pointers.

https://github.com/llvm/llvm-project/pull/178768
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to