[PATCH] D28297: [StaticAnalyzer] Fix crash in CastToStructChecker

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 01:33:11 PST 2017


a.sidorin added a comment.

Looks like a right fix.



================
Comment at: lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp:93
 
     // Warn when there is widening cast.
     unsigned ToWidth = Ctx.getTypeInfo(ToPointeeTy).Width;
----------------
NoQ wrote:
> I think we should move the check here then. That'd avoid double-checking if `ToPointeeTy` is a record type (we could `cast<>` directly on this branch).
Or just hoist it out of condition?


https://reviews.llvm.org/D28297





More information about the cfe-commits mailing list