[clang] 4ae0c50 - [clang] Fix static analyzer concerns (#110243)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 08:07:27 PDT 2024


Author: Mariya Podchishchaeva
Date: 2024-09-30T17:07:23+02:00
New Revision: 4ae0c5059ec9a3254bc501c24b24f7182eba12a6

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

LOG: [clang] Fix static analyzer concerns (#110243)

It seems in checkOpenMPIterationSpace `OrderedLoopCountExpr` can also be
null, so check before dereferencing.

Added: 
    

Modified: 
    clang/lib/Sema/SemaOpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9afb8cea26fe78..8615da4b044a82 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -9195,7 +9195,7 @@ static bool checkOpenMPIterationSpace(
         SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
                      diag::note_omp_collapse_ordered_expr)
             << 0 << CollapseLoopCountExpr->getSourceRange();
-      else
+      else if (OrderedLoopCountExpr)
         SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
                      diag::note_omp_collapse_ordered_expr)
             << 1 << OrderedLoopCountExpr->getSourceRange();


        


More information about the cfe-commits mailing list