Skip to content

Commit

Permalink
[Clang][Sema][NFC]Use isa_and_nonnull to simplify the code and avoid …
Browse files Browse the repository at this point in the history
…build warning (llvm#84181)

Signed-off-by: nwh <nwh_work@foxmail.com>
  • Loading branch information
ZERO-N authored Mar 6, 2024
1 parent d4687fe commit 28e30b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaExceptionSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,13 +1017,13 @@ CanThrowResult Sema::canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
SourceLocation Loc) {
// As an extension, we assume that __attribute__((nothrow)) functions don't
// throw.
if (D && isa<FunctionDecl>(D) && D->hasAttr<NoThrowAttr>())
if (isa_and_nonnull<FunctionDecl>(D) && D->hasAttr<NoThrowAttr>())
return CT_Cannot;

QualType T;

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

0 comments on commit 28e30b4

Please sign in to comment.