[PATCH] D79704: [Analyzer] [NFC] Parameter Regions
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 13 10:50:41 PDT 2020
NoQ added a comment.
In D79704#2032947 <https://reviews.llvm.org/D79704#2032947>, @Szelethus wrote:
> In D79704#2032271 <https://reviews.llvm.org/D79704#2032271>, @NoQ wrote:
>
> > Blanket reply! `ParamRegion` is not a `DeclRegion` because it does not necessarily have a corresponding `Decl`. For instance, when calling a function through an unknown function pointer, you don't have the declaration of a function, let alone its parameters.
>
>
> Well hold on for a second then -- how is this, if it is, different for member pointers? Aren't they represented with a `VarRegion`?
They aren't even `Loc`!
We currently don't have a representation for an unknown pointer-to-member. A known pointer-to-member is represented by a `FieldDecl` (not sure about static members) but it's still a `NonLoc` and as such isn't a region at all. Because, well, you can't dereference a pointer-to-member; you can only apply it to a base pointer like an offset. The mental model is "an offset". Therefore it's `NonLoc`.
Pointers to member functions are a different thing; they're function pointers so they're kinda regions.
>> But for parameters of C++ object type you still need your `ParamRegion` because arguments are constructed into it.
>
> Could you give a specific code example?
struct S {
S() {
this; // What region does 'this' point to...
}
};
void foo(void (*bar)(S)) {
bar(S()); // ...in this invocation?
}
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79704/new/
https://reviews.llvm.org/D79704
More information about the cfe-commits
mailing list