Author: Gábor Tóthvári
Date: 2026-09-15T09:50:38+02:00
New Revision: 74bdb1594ec40502b46dd12d8c0ee096561869cb

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

LOG: [NFC][analyzer] Do not spell out unreachable statement kinds in 
`shouldJustCallCheckers` (#223473)

The function `shouldJustCallCheckers` introduced recently in
e829049823905405779c6b908437b200e7ed1b2e returns true by default and
returns false for statement kinds where it is inappropriate to call the
PreStmt and PostStmt checkers in the "normal" pattern.

Unreachable statement kinds (e.g. control flow statements that never
appear as non-terminator statements in a CFGBlock) were covered by
explicit cases in `shouldJustCallCheckers`, but this was needless
complexity, so this commit removes it. These statement kinds run into
`llvm_unreachable` in `ExprEngine::Visit`, so the behavior of
`shouldJustCallCheckers` is completely inconsequential.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp 
b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index e482cb7ef7a55..1d4f0fe975e1c 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1248,47 +1248,6 @@ static bool shouldJustCallCheckers(const Stmt *S, 
VisitKind K) {
   case Stmt::HLSLOutArgExprClass:
     return false;
 
-  // ParenExprs already handled.
-  case Stmt::ParenExprClass:
-    return false;
-
-  // GenericSelectionExprs already handled.
-  case Stmt::GenericSelectionExprClass:
-    return false;
-
-  // Cases that should never be evaluated simply because they shouldn't
-  // appear in the CFG.
-  case Stmt::BreakStmtClass:
-  case Stmt::CaseStmtClass:
-  case Stmt::CompoundStmtClass:
-  case Stmt::ContinueStmtClass:
-  case Stmt::CXXForRangeStmtClass:
-  case Stmt::DefaultStmtClass:
-  case Stmt::DoStmtClass:
-  case Stmt::ForStmtClass:
-  case Stmt::GotoStmtClass:
-  case Stmt::IfStmtClass:
-  case Stmt::IndirectGotoStmtClass:
-  case Stmt::LabelStmtClass:
-  case Stmt::NoStmtClass:
-  case Stmt::NullStmtClass:
-  case Stmt::SwitchStmtClass:
-  case Stmt::WhileStmtClass:
-  case Stmt::DeferStmtClass:
-  case Expr::MSDependentExistsStmtClass:
-    return false;
-
-  // These nodes are shared in the CFG and would case caching out.
-  // Moreover, no additional evaluation required for them, the
-  // analyzer can reconstruct these values from the AST.
-  case Stmt::ImplicitValueInitExprClass:
-    return false;
-
-  // These are handled by PseudoObjectExpr
-  case Stmt::ObjCSubscriptRefExprClass:
-  case Stmt::ObjCPropertyRefExprClass:
-    return false;
-
   // FIXME: Does not call checkers
   case Stmt::GNUNullExprClass:
     return false;
@@ -1302,14 +1261,6 @@ static bool shouldJustCallCheckers(const Stmt *S, 
VisitKind K) {
   case Stmt::ExprWithCleanupsClass:
     return false;
 
-  // Support for MatrixSingleSubscriptExprClass is not implemented.
-  case Stmt::MatrixSingleSubscriptExprClass:
-    return false;
-
-  // Support for MatrixSubscriptExpr is not implemented.
-  case Stmt::MatrixSubscriptExprClass:
-    return false;
-
   // FIXME: Does not call checkers
   case Stmt::MSAsmStmtClass:
     return false;


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to