[PATCH] D102280: [analyzer] Engine: fix crash with SEH __leave keyword

Abbas Sabra via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 14 06:02:06 PDT 2021


AbbasSabra updated this revision to Diff 345422.
AbbasSabra added a comment.

Updating D102280 <https://reviews.llvm.org/D102280>: [analyzer] rename test file + make sure that statements after "__leave" are not reached


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102280/new/

https://reviews.llvm.org/D102280

Files:
  clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
  clang/test/Analysis/ms-seh.cpp


Index: clang/test/Analysis/ms-seh.cpp
===================================================================
--- /dev/null
+++ clang/test/Analysis/ms-seh.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions -verify %s
+
+void clang_analyzer_warnIfReached();
+int filter();
+
+void try_except_leave() {
+  __try {
+    __leave;                        // no-crash
+    clang_analyzer_warnIfReached(); // no-warning
+  } __except (filter()) {
+  }
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
Index: clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -349,6 +349,7 @@
         HandleBranch(cast<ForStmt>(Term)->getCond(), Term, B, Pred);
         return;
 
+      case Stmt::SEHLeaveStmtClass:
       case Stmt::ContinueStmtClass:
       case Stmt::BreakStmtClass:
       case Stmt::GotoStmtClass:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102280.345422.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210514/e69f10ad/attachment.bin>


More information about the cfe-commits mailing list