[libTooling] Change `access` stencil to recognize use of `operator*`.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Wed, 16 Jun 2021 14:52:13 +0000 (14:52 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Wed, 16 Jun 2021 20:34:00 +0000 (20:34 +0000)
commitc7ed4fe56e0a6c664c5fb5dedaedb426abe7224d
treec09029ab302c64d045bc4dfda37b1445baf4ee7a
parentf9a6d47c3642cb07b5e98e8b08330ccc95b85dd8
[libTooling] Change `access` stencil to recognize use of `operator*`.

Currently, `access` doesn't recognize a dereferenced smart pointer. So,
`access(e, "field")` where `e = *x`, yields:
* `x->field`, for normal-pointer x,
* `(*x).field`, for smart-pointer x.

This patch normalizes handling of smart pointer to match normal pointer, when
the smart pointer type supports `->`.

Differential Revision: https://reviews.llvm.org/D104390
clang/lib/Tooling/Transformer/Stencil.cpp
clang/unittests/Tooling/StencilTest.cpp