This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Support SVal::getType for pointer-to-member values
AcceptedPublic

Authored by vsavchenko on Jun 21 2021, 7:55 AM.

Diff Detail

Event Timeline

vsavchenko created this revision.Jun 21 2021, 7:55 AM
vsavchenko requested review of this revision.Jun 21 2021, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2021, 7:55 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This one is a bit more invasive, so I decided to put it into a separate patch.

Restore behavior for nullptr declarations

NoQ added inline comments.Jun 29 2021, 2:24 PM
clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
85

What prevents you from obtaining the type from D? I guess NamedDecl itself doesn't provide a getType() on its own but what specific sub-classes can D be that don't have a type?

vsavchenko added inline comments.Aug 3 2021, 7:57 AM
clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
85

Because it's not a declaration of pointer-to-member, but a declaration of the actual member. It can be nullptr while the type is always known.
I'd prefer not to construct a pointer-to-member type myself. It's the work for Sema, not for the analyzer.

martong accepted this revision.Aug 30 2021, 7:53 AM

This looks good to me.

This revision is now accepted and ready to land.Aug 30 2021, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2022, 11:18 AM

@vsavchenko Is this alive?

I think, we could commit this and set Valery as the author (he is no longer working on CSA).
Unless you find something wrong with the patch; in that case we can still make changes after we commandeer the patch.