forked from OSchip/llvm-project
Use a dyn_cast to avoid a crash when the TypeLoc is not a ConstantArrayTypeLoc.
rdar://13153516 llvm-svn: 174477
This commit is contained in:
parent
906ba47143
commit
7029992807
|
@ -5777,10 +5777,11 @@ static bool IsTailPaddedMemberArray(Sema &S, llvm::APInt Size,
|
||||||
TInfo = TDL->getTypeSourceInfo();
|
TInfo = TDL->getTypeSourceInfo();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ConstantArrayTypeLoc CTL = cast<ConstantArrayTypeLoc>(TL);
|
if (const ConstantArrayTypeLoc *CTL = dyn_cast<ConstantArrayTypeLoc>(&TL)) {
|
||||||
const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr());
|
const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL->getSizeExpr());
|
||||||
if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
|
if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue