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

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 07:57:48 PDT 2021


vsavchenko added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:85
   const NamedDecl *D;
+  QualType T;
   llvm::ImmutableList<const CXXBaseSpecifier *> L;
----------------
NoQ wrote:
> 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?
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104647/new/

https://reviews.llvm.org/D104647



More information about the cfe-commits mailing list