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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 07:20:04 PST 2017


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

I sometimes wish ASTContext methods just didn't crash :)
Oh well, let's just see if more problems show up.



================
Comment at: lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp:93
 
     // Warn when there is widening cast.
     unsigned ToWidth = Ctx.getTypeInfo(ToPointeeTy).Width;
----------------
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).


Repository:
  rL LLVM

https://reviews.llvm.org/D28297





More information about the cfe-commits mailing list