diff options
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 5 | ||||
-rw-r--r-- | test/Analysis/misc-ps-region-store.cpp | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 245f587bac..a14a491333 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -268,6 +268,11 @@ void ExprEngine::VisitCXXCatchStmt(const CXXCatchStmt *CS, ExplodedNode *Pred, ExplodedNodeSet &Dst) { const VarDecl *VD = CS->getExceptionDecl(); + if (!VD) { + Dst.Add(Pred); + return; + } + const LocationContext *LCtx = Pred->getLocationContext(); SVal V = svalBuilder.getConjuredSymbolVal(CS, LCtx, VD->getType(), currentBuilderContext->getCurrentBlockCount()); diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp index 9fa0b860f2..00dff70480 100644 --- a/test/Analysis/misc-ps-region-store.cpp +++ b/test/Analysis/misc-ps-region-store.cpp @@ -529,3 +529,26 @@ MyEnum rdar10892489_positive() { return MyEnumValue; } +// Test handling of catch with no condition variable. +void PR11545() { + try + { + throw; + } + catch (...) + { + } +} + +void PR11545_positive() { + try + { + throw; + } + catch (...) + { + int *p = 0; + *p = 0xDEADBEEF; // expected-warning {{null}} + } +} + |