Skip to content

Commit 28e30b4

Browse files
authored
[Clang][Sema][NFC]Use isa_and_nonnull to simplify the code and avoid build warning (#84181)
Signed-off-by: nwh <[email protected]>
1 parent d4687fe commit 28e30b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Sema/SemaExceptionSpec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,13 +1017,13 @@ CanThrowResult Sema::canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
10171017
SourceLocation Loc) {
10181018
// As an extension, we assume that __attribute__((nothrow)) functions don't
10191019
// throw.
1020-
if (D && isa<FunctionDecl>(D) && D->hasAttr<NoThrowAttr>())
1020+
if (isa_and_nonnull<FunctionDecl>(D) && D->hasAttr<NoThrowAttr>())
10211021
return CT_Cannot;
10221022

10231023
QualType T;
10241024

10251025
// In C++1z, just look at the function type of the callee.
1026-
if (S.getLangOpts().CPlusPlus17 && E && isa<CallExpr>(E)) {
1026+
if (S.getLangOpts().CPlusPlus17 && isa_and_nonnull<CallExpr>(E)) {
10271027
E = cast<CallExpr>(E)->getCallee();
10281028
T = E->getType();
10291029
if (T->isSpecificPlaceholderType(BuiltinType::BoundMember)) {

0 commit comments

Comments
 (0)