[clang] 7dc0a37 - [Clang][SYCL] Remove unnecessary null pointer check (#206813)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 15:00:56 PDT 2026


Author: Tom Honermann
Date: 2026-06-30T18:00:51-04:00
New Revision: 7dc0a37db17b845a9883e20749282bf89531b32f

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

LOG: [Clang][SYCL] Remove unnecessary null pointer check (#206813)

Static analysis identified a null pointer check in a control flow path
that unconditionally dereferences the checked pointer. This patch
removes the unnecessary check.

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d45c3eb35094f..f6d1d7a7877c7 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -16474,7 +16474,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D,
 
   maybeAddDeclWithEffects(FD);
 
-  if (FD && !FD->isInvalidDecl() && FD->hasAttr<SYCLKernelEntryPointAttr>() &&
+  if (!FD->isInvalidDecl() && FD->hasAttr<SYCLKernelEntryPointAttr>() &&
       FnBodyScope) {
     // An implicit call expression is synthesized for functions declared with
     // the sycl_kernel_entry_point attribute. The call may resolve to a


        


More information about the cfe-commits mailing list