[clang] [RFC][Clang] Add the __addrspaceof operator (PR #210242)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 10:47:26 PDT 2026


================
@@ -1741,6 +1742,61 @@ UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr(
   setDependence(computeDependence(this));
 }
 
+static const ValueDecl *getAddrSpaceOfEntity(const Expr *E) {
----------------
AaronBallman wrote:

Should this be looking through other kinds of expressions? e.g.,
```
#define FOO(X) _Generic(X, typeof_unqual(X) : X)
__device__ int i;
static_assert(__addrspaceof(FOO(i)) == __ADDRSPACE_GLOBAL);
```

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


More information about the cfe-commits mailing list