[Diagnostics] Teach -Wnull-dereference about address_space attribute
authorDávid Bolvanský <david.bolvansky@gmail.com>
Thu, 7 Nov 2019 19:47:09 +0000 (20:47 +0100)
committerDávid Bolvanský <david.bolvansky@gmail.com>
Thu, 7 Nov 2019 21:43:27 +0000 (22:43 +0100)
commit01b10bc7b14963902405d202ac78cd88d44adbc5
tree7f74a71a56d6973a5db7275673c1d46ea72eecb6
parentb95bb0847a1ea366dda69901c24415e0d00a9527
[Diagnostics] Teach -Wnull-dereference about address_space attribute

Summary:
Clang should not warn for:

> test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
>       not trap [-Wnull-dereference]
>     return *(int __attribute__((address_space(256))) *) 0;
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solves PR42292.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69664
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/exprs.c