[analyzer] Engine: fix crash with SEH __leave keyword
MSVC has a `try-except` statement. This statement could containt a `__leave` keyword, which is similar to `goto` to the end of the try block. The semantic of this keyword is not implemented. We should at least parse such code without crashing. https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement?view=msvc-160 Patch By: AbbasSabra! Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D102280
This commit is contained in:
parent
14dfb3831c
commit
ebcf030efc
@ -349,6 +349,7 @@ void CoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode *Pred) {
|
||||
HandleBranch(cast<ForStmt>(Term)->getCond(), Term, B, Pred);
|
||||
return;
|
||||
|
||||
case Stmt::SEHLeaveStmtClass:
|
||||
case Stmt::ContinueStmtClass:
|
||||
case Stmt::BreakStmtClass:
|
||||
case Stmt::GotoStmtClass:
|
||||
|
||||
13
clang/test/Analysis/ms-seh.cpp
Normal file
13
clang/test/Analysis/ms-seh.cpp
Normal file
@ -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}}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user