Fix analyzer crash on analyzing 'catch' with no condition variable.

llvm-svn: 152900
This commit is contained in:
Ted Kremenek 2012-03-16 05:58:15 +00:00
parent 48c112babe
commit b1279b5c47
2 changed files with 28 additions and 0 deletions

View File

@ -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());

View File

@ -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}}
}
}