[clang] cbe9911 - [clang] MarkVarDeclODRUsed - remove redundant nullptr check. NFCI.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 26 13:24:32 PST 2022


Author: Simon Pilgrim
Date: 2022-02-26T21:24:26Z
New Revision: cbe9911845eed262b265d2c6b5f600825145330b

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

LOG: [clang] MarkVarDeclODRUsed - remove redundant nullptr check. NFCI.

The function has already been dereferenced the Var pointer

Added: 
    

Modified: 
    clang/lib/Sema/SemaExpr.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b24caa56a38ad..bd7110d0315d9 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17500,7 +17500,7 @@ MarkVarDeclODRUsed(VarDecl *Var, SourceLocation Loc, Sema &SemaRef,
     CaptureType, DeclRefType,
     FunctionScopeIndexToStopAt);
 
-  if (SemaRef.LangOpts.CUDA && Var && Var->hasGlobalStorage()) {
+  if (SemaRef.LangOpts.CUDA && Var->hasGlobalStorage()) {
     auto *FD = dyn_cast_or_null<FunctionDecl>(SemaRef.CurContext);
     auto VarTarget = SemaRef.IdentifyCUDATarget(Var);
     auto UserTarget = SemaRef.IdentifyCUDATarget(FD);


        


More information about the cfe-commits mailing list