Author: ZERO-N
Date: 2024-03-07T00:07:15+08:00
New Revision: 28e30b4042742bb79cc66b92a16a8508aa35cb92

URL: 
https://github.com/llvm/llvm-project/commit/28e30b4042742bb79cc66b92a16a8508aa35cb92
DIFF: 
https://github.com/llvm/llvm-project/commit/28e30b4042742bb79cc66b92a16a8508aa35cb92.diff

LOG: [Clang][Sema][NFC]Use isa_and_nonnull to simplify the code and avoid build 
warning (#84181)

Signed-off-by: nwh <nwh_w...@foxmail.com>

Added: 
    

Modified: 
    clang/lib/Sema/SemaExceptionSpec.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaExceptionSpec.cpp 
b/clang/lib/Sema/SemaExceptionSpec.cpp
index 3563b4f683f079..00384f9dc16aa0 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -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)) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to