================
@@ -4586,6 +4586,32 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *E,
   return false;
 }
 
+static bool CheckAddrSpaceOfExpr(Sema &S, Expr *E) {
+  if (E->isTypeDependent())
+    return false;
+
+  const ValueDecl *D = nullptr;
+  if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
+    D = dyn_cast<ValueDecl>(DRE->getDecl());
+  else if (const auto *ME = dyn_cast<MemberExpr>(E))
+    D = ME->getMemberDecl();
+
+  if (D) {
+    if (isa<VarDecl, FieldDecl>(D))
----------------
AaronBallman wrote:

This seems perhaps overly restrictive (as mentioned above, binding decls can 
have address spaces); you could also run into things like:
```
__addrspaceof((int [[clang::address_space(12)]]){100})
```
which should presumably have an address space associated with it?

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

Reply via email to