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

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 14 05:28:02 PST 2024


https://github.com/bricknerb created https://github.com/llvm/llvm-project/pull/116226

None

>From 35c1a01df73a52acda55bb4a162fdbddd03c764d Mon Sep 17 00:00:00 2001
From: Boaz Brickner <brickner at google.com>
Date: Thu, 14 Nov 2024 14:27:33 +0100
Subject: [PATCH] [clang] [NFC] Merge two ifs to a single one

---
 clang/lib/Sema/SemaCUDA.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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