On Feb 5, 2013, at 7:27 PM, David Blaikie <[email protected]> wrote:
> > On Feb 5, 2013 5:00 PM, "Chad Rosier" <[email protected]> wrote: > > > > Author: mcrosier > > Date: Tue Feb 5 18:58:34 2013 > > New Revision: 174477 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=174477&view=rev > > Log: > > Use a dyn_cast to avoid a crash when the TypeLoc is not a > > ConstantArrayTypeLoc. > > rdar://13153516 > > > > Modified: > > cfe/trunk/lib/Sema/SemaChecking.cpp > > Test case? > > Certainly, I'll see if I can't reduce the original test case and commit shortly. Chad > > > > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=174477&r1=174476&r2=174477&view=diff > > ============================================================================== > > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) > > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Feb 5 18:58:34 2013 > > @@ -5777,10 +5777,11 @@ static bool IsTailPaddedMemberArray(Sema > > TInfo = TDL->getTypeSourceInfo(); > > continue; > > } > > - ConstantArrayTypeLoc CTL = cast<ConstantArrayTypeLoc>(TL); > > - const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr()); > > - if (!SizeExpr || SizeExpr->getExprLoc().isMacroID()) > > - return false; > > + if (const ConstantArrayTypeLoc *CTL = > > dyn_cast<ConstantArrayTypeLoc>(&TL)) { > > + const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL->getSizeExpr()); > > + if (!SizeExpr || SizeExpr->getExprLoc().isMacroID()) > > + return false; > > + } > > break; > > } > > > > > > > > _______________________________________________ > > cfe-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
