Author: Timm Bäder
Date: 2023-12-19T09:46:06+01:00
New Revision: 258c2ae9dfc8a16c837975efdaad7aeaa1e647be

URL: 
https://github.com/llvm/llvm-project/commit/258c2ae9dfc8a16c837975efdaad7aeaa1e647be
DIFF: 
https://github.com/llvm/llvm-project/commit/258c2ae9dfc8a16c837975efdaad7aeaa1e647be.diff

LOG: [clang][Sema][NFC] Merge two if statements

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index edf44bbc52119b..7dde037baccfe7 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2211,10 +2211,9 @@ void Sema::DiagnoseUnusedButSetDecl(const VarDecl *VD,
       return;
     // In C++, don't warn for record types that don't have WarnUnusedAttr, to
     // mimic gcc's behavior.
-    if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Tag)) {
-      if (!RD->hasAttr<WarnUnusedAttr>())
-        return;
-    }
+    if (const auto *RD = dyn_cast<CXXRecordDecl>(Tag);
+        RD && !RD->hasAttr<WarnUnusedAttr>())
+      return;
   }
 
   // Don't warn about __block Objective-C pointer variables, as they might


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

Reply via email to