diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -259,7 +259,7 @@ for (const auto *CallExpr : CEF.getCallExprs()) { const Decl *Decl = CallExpr->getCalleeDecl(); - if (Decl->hasAttr() || Decl->hasAttr()) + if (Decl && (Decl->hasAttr() || Decl->hasAttr())) S.Diag(St->getBeginLoc(), diag::warn_function_stmt_attribute_precedence) << A << (Decl->hasAttr() ? 2 : 1); }