diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp --- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -349,6 +349,7 @@ HandleBranch(cast(Term)->getCond(), Term, B, Pred); return; + case Stmt::SEHLeaveStmtClass: case Stmt::ContinueStmtClass: case Stmt::BreakStmtClass: case Stmt::GotoStmtClass: diff --git a/clang/test/Analysis/misc-ms-leave.cpp b/clang/test/Analysis/misc-ms-leave.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Analysis/misc-ms-leave.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions -verify %s + +void test() { + int *p = 0; + int x = *p; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}} +} + +int filter(); + +void try_except_leave() { + __try { + __leave; + } __except (filter()) { + } + int *p = 0; + int x = *p; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}} +}