[clang-tools-extra] [include-cleaner] Support Objective-C toll-free bridged casts (PR #216158)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 10:52:05 PDT 2026
================
@@ -482,13 +483,18 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
bool VisitCastExpr(CastExpr *E) {
// Handle implicit or explicit casts between Objective-C object pointers
// aimed towards protocol-qualification (e.g., `ClassName *` to
- // `id<Proto>`).
+ // `id<Proto>`), as well as toll-free bridged C-pointer-to-ObjC casts.
QualType SourceType = E->getSubExpr()->getType();
QualType DestType = E->getType();
const auto *SrcPtr = SourceType->getAs<ObjCObjectPointerType>();
const auto *DestPtr = DestType->getAs<ObjCObjectPointerType>();
+ if (E->getCastKind() == CK_CPointerToObjCPointerCast) {
----------------
dmaclach wrote:
Yes.. was missing this test (didn't get copied across). Added the test and updated the comment.
https://github.com/llvm/llvm-project/pull/216158
More information about the cfe-commits
mailing list