[PATCH] D153960: [clang][dataflow] Implement support for pointers to members.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 28 05:12:52 PDT 2023


sammccall accepted this revision.
sammccall added a comment.

Per offline discussion, I think modelling pointer-to-member as PointerValue does make sense, though that's not completely obvious.
Can we document this on PointerValue? (And that it points to a StorageLocation for the decl, which has no value)



================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:236
+    // `DeclRefExpr`s to fields and non-static methods aren't glvalues, and
+    // there's also no sensible `Value` we can assign to them, so skip them.
+    if (isa<FieldDecl>(VD))
----------------
I'm a bit confused by this. Why bail out rather than create the storage location?

`C::x` is going to be part of `&C::x`, and we're going to create the storagelocation by calling getStorageLocation() on line 456. So why not do it already?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153960



More information about the cfe-commits mailing list