[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:38 PDT 2026
================
@@ -56,28 +56,33 @@ void walkUsed(llvm::ArrayRef<Decl *> ASTRoots,
const auto &SM = PP.getSourceManager();
// This is duplicated in writeHTMLReport, changes should be mirrored there.
tooling::stdlib::Recognizer Recognizer;
+ ObjCSelectorMap SelectorDecls;
+ if (!ASTRoots.empty()) {
+ SelectorDecls = buildObjCSelectorMap(ASTRoots.front()->getASTContext());
----------------
nico wrote:
If I understand correctly, this does a walk of the whole TU at "startup". This will deserialize all decls in preamble PCHs, which is bad for perf and memory usage. (walkUsed can be called from clangd in relatively common code paths, right? And it passes in not the whole root, to prevent a full deserialize as far as I understand: `rg -A1 walkUsed clang-tools-extra/clangd`)
Not sure what to do instead though!
It'd be slightly better to do this lazily when it's first needed, but having to walk all decls is unfortunate.
https://github.com/llvm/llvm-project/pull/212564
More information about the cfe-commits
mailing list