[clang] fa5a10d - [clang] [NFC] Merge two ifs to a single one (#116226)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 06:09:52 PST 2024


Author: Boaz Brickner
Date: 2024-11-15T15:09:44+01:00
New Revision: fa5a10d6313e94795739c79eb3c0774d5f8e3461

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

LOG: [clang] [NFC] Merge two ifs to a single one (#116226)

Added: 
    

Modified: 
    clang/lib/Sema/SemaCUDA.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index ec37c0df56c671..6fe10e41e3d9f2 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -659,9 +659,9 @@ void SemaCUDA::checkAllowedInitializer(VarDecl *VD) {
   // Return early if VD is inside a non-instantiated template function since
   // the implicit constructor is not defined yet.
   if (const FunctionDecl *FD =
-          dyn_cast_or_null<FunctionDecl>(VD->getDeclContext()))
-    if (FD->isDependentContext())
-      return;
+          dyn_cast_or_null<FunctionDecl>(VD->getDeclContext());
+      FD && FD->isDependentContext())
+    return;
 
   // Do not check dependent variables since the ctor/dtor/initializer are not
   // determined. Do it after instantiation.


        


More information about the cfe-commits mailing list