forked from OSchip/llvm-project
[Diagnostics] Fixed crash with non pointer type (PR43950)
This commit is contained in:
parent
e4da37e8a0
commit
312c6f699d
|
@ -482,7 +482,8 @@ static void CheckForNullPointerDereference(Sema &S, Expr *E) {
|
|||
// to get a deterministic trap and are surprised by clang's behavior. This
|
||||
// only handles the pattern "*null", which is a very syntactic check.
|
||||
const auto *UO = dyn_cast<UnaryOperator>(E->IgnoreParenCasts());
|
||||
if (UO && UO->getOpcode() == UO_Deref) {
|
||||
if (UO && UO->getOpcode() == UO_Deref &&
|
||||
UO->getSubExpr()->getType()->isPointerType()) {
|
||||
const LangAS AS =
|
||||
UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
|
||||
if ((!isTargetAddressSpace(AS) ||
|
||||
|
|
Loading…
Reference in New Issue