================
@@ -613,7 +613,10 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
bool VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
if (auto *Ivar = E->getDecl()) {
- report(E->getLocation(), Ivar);
+ if (auto *Cat = dyn_cast<ObjCCategoryDecl>(Ivar->getDeclContext()))
+ report(E->getLocation(), Cat, RefType::Implicit);
+ else if (auto *IFace = Ivar->getContainingInterface())
----------------
nico wrote:
nit: please say in the commit message why you picked `getContainingInterface`
(as opposed to `E->getBase()->IgnoreImpCasts()->getType()` which the
corresponding c++ code in this file uses) here. Your pick reports the base type
if you have a derived pointer that accesses an ivar that's in the inherited
base; the c++ path reports the derived type.
This is absolutely a defensible choice due to that class extension case we've
been discussing a few times, but it'd be nice to mention the deliberate
difference the commit message at least.
https://github.com/llvm/llvm-project/pull/220713
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits