Page MenuHomePhabricator

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

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.Tue, Aug 3, 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.