<p dir="ltr"><br>
On Feb 5, 2013 5:00 PM, "Chad Rosier" <<a href="mailto:mcrosier@apple.com">mcrosier@apple.com</a>> wrote:<br>
><br>
> Author: mcrosier<br>
> Date: Tue Feb 5 18:58:34 2013<br>
> New Revision: 174477<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=174477&view=rev">http://llvm.org/viewvc/llvm-project?rev=174477&view=rev</a><br>
> Log:<br>
> Use a dyn_cast to avoid a crash when the TypeLoc is not a ConstantArrayTypeLoc.<br>
> rdar://13153516<br>
><br>
> Modified:<br>
> cfe/trunk/lib/Sema/SemaChecking.cpp</p>
<p dir="ltr">Test case?</p>
<p dir="ltr">><br>
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=174477&r1=174476&r2=174477&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=174477&r1=174476&r2=174477&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Feb 5 18:58:34 2013<br>
> @@ -5777,10 +5777,11 @@ static bool IsTailPaddedMemberArray(Sema<br>
> TInfo = TDL->getTypeSourceInfo();<br>
> continue;<br>
> }<br>
> - ConstantArrayTypeLoc CTL = cast<ConstantArrayTypeLoc>(TL);<br>
> - const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr());<br>
> - if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())<br>
> - return false;<br>
> + if (const ConstantArrayTypeLoc *CTL = dyn_cast<ConstantArrayTypeLoc>(&TL)) {<br>
> + const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL->getSizeExpr());<br>
> + if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())<br>
> + return false;<br>
> + }<br>
> break;<br>
> }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</p>