forked from OSchip/llvm-project
Fix analyzer crash on analyzing 'catch' with no condition variable.
llvm-svn: 152900
This commit is contained in:
parent
48c112babe
commit
b1279b5c47
|
@ -268,6 +268,11 @@ void ExprEngine::VisitCXXCatchStmt(const CXXCatchStmt *CS,
|
||||||
ExplodedNode *Pred,
|
ExplodedNode *Pred,
|
||||||
ExplodedNodeSet &Dst) {
|
ExplodedNodeSet &Dst) {
|
||||||
const VarDecl *VD = CS->getExceptionDecl();
|
const VarDecl *VD = CS->getExceptionDecl();
|
||||||
|
if (!VD) {
|
||||||
|
Dst.Add(Pred);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const LocationContext *LCtx = Pred->getLocationContext();
|
const LocationContext *LCtx = Pred->getLocationContext();
|
||||||
SVal V = svalBuilder.getConjuredSymbolVal(CS, LCtx, VD->getType(),
|
SVal V = svalBuilder.getConjuredSymbolVal(CS, LCtx, VD->getType(),
|
||||||
currentBuilderContext->getCurrentBlockCount());
|
currentBuilderContext->getCurrentBlockCount());
|
||||||
|
|
|
@ -529,3 +529,26 @@ MyEnum rdar10892489_positive() {
|
||||||
return MyEnumValue;
|
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}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue