This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fixing SVal::getType returns Null Type for NonLoc::ConcreteInt in boolean type
ClosedPublic

Authored by OikawaKirie on Jul 14 2022, 12:51 AM.

Details

Summary

In method TypeRetrievingVisitor::VisitConcreteInt, ASTContext::getIntTypeForBitwidth is used to get the type for ConcreteInts.
However, the getter in ASTContext cannot handle the boolean type with the bit width of 1, which will make method SVal::getType return a Null Type.
In this patch, a check for this case is added to fix this problem by returning the bool type directly when the bit width is 1.

Diff Detail

Event Timeline

OikawaKirie created this revision.Jul 14 2022, 12:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2022, 12:51 AM
OikawaKirie requested review of this revision.Jul 14 2022, 12:51 AM
martong accepted this revision.Jul 14 2022, 5:15 AM

Thanks! LGTM!

This revision is now accepted and ready to land.Jul 14 2022, 5:15 AM