[PATCH] D39862: [analyzer] do not crash when trying to convert an APSInt to an unexpected type

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 9 13:20:25 PST 2017

NoQ added a comment.

I'm curious if the crash would turn into an assertion failure during `getRawSVal()` after https://reviews.llvm.org/D38801 is committed.

The problem with this checker producing void symbols is known since https://reviews.llvm.org/D26837. If this problem is fixed on the checker side (it probably should be - the checker , we can probably put stronger asserts onto types suitable for symbols.

Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:265
+  // to the type of T, which is not always the case (e.g. for void).
+  if (!T.isNull() && (T->isIntegralOrEnumerationType() || Loc::isLocType(T))) {
     if (SymbolRef sym = V.getAsSymbol()) {
If a type is an integral or enumeration type or a Loc type, then it is definitely not null.


More information about the cfe-commits mailing list