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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Boaz Brickner (bricknerb)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/116226.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaCUDA.cpp (+3-3) 


``````````diff
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.

``````````

</details>


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


More information about the cfe-commits mailing list