aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM with a testing request.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:486
if (UO->getOpcode() == UO_Deref &&
- UO->getSubExpr()->IgnoreParenCasts()->
- isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull)
&&
+ !isTargetAddressSpace(
+ UO->getSubExpr()->getType()->getPointeeType().getAddressSpace()) &&
----------------
xbolva00 wrote:
> With this patch, we no longer warn for:
>
> *(int __attribute__((address_space(0))) *) 0;
>
> Worth to handle this case?
I mildly think it would be useful to warn in that case, but I'm fine with that
being done later.
================
Comment at: clang/test/Sema/exprs.c:190
+ *(int_AS256*)0 = 0; // Ok.
// rdar://9269271
----------------
Can you add a test case for dereferencing for a read instead of a write, just
to ensure we don't diagnose that case?
You may want to add the `address_space(0)` test case as well, with a FIXME that
it should warn at some point.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69664/new/
https://reviews.llvm.org/D69664
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits