[clang-tools-extra] [clang][include-cleaner] Support ObjC @selector expressions in WalkAST (PR #212564)

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 22:11:39 PDT 2026


================
@@ -39,8 +43,42 @@ bool isOperatorNewDelete(OverloadedOperatorKind OpKind) {
 using DeclCallback =
     llvm::function_ref<void(SourceLocation, NamedDecl &, RefType)>;
 
+class ObjCSelectorDeclMapBuilder
+    : public RecursiveASTVisitor<ObjCSelectorDeclMapBuilder> {
+public:
+  ObjCSelectorMap takeMap() { return std::move(Map); }
+
+  bool TraverseDecl(clang::Decl *D) {
+    if (!D)
+      return true;
+    if (auto *Container = llvm::dyn_cast<clang::ObjCContainerDecl>(D)) {
+      for (clang::ObjCMethodDecl *M : Container->methods()) {
+        if (M) {
----------------
nico wrote:

nit: I think LLVM style discourages braces for single-line ifs (also elsewhere)

https://github.com/llvm/llvm-project/pull/212564


More information about the cfe-commits mailing list