================
@@ -458,6 +458,35 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
if (auto *Setter = E->getImplicitPropertySetter())
report(E->getLocation(), Setter);
}
+
+ // Report the receiver to ensure its declaring header is kept.
+ if (E->isObjectReceiver()) {
+ QualType Type = E->getBase()->IgnoreImpCasts()->getType();
+ if (const auto *ObjCPtr = Type->getAs<ObjCObjectPointerType>()) {
+ if (auto *Interface = ObjCPtr->getInterfaceDecl()) {
+ report(E->getLocation(), Interface, RefType::Implicit);
+ }
+ for (const auto *Proto : ObjCPtr->quals()) {
+ report(E->getLocation(), const_cast<ObjCProtocolDecl *>(Proto),
+ RefType::Implicit);
+ }
+ }
+ } else if (E->isClassReceiver()) {
----------------
nico wrote:
Do any of the tests fail if it's removed?
https://github.com/llvm/llvm-project/pull/212633
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits