[clang-tools-extra] [clangd] Add AddUsingReplaceAll tweak to replace all qualified refere… (PR #204151)
Dimitri Ratz via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 3 00:49:42 PST 2026
ratzdi wrote:
> > Hello. `prepare()` should be fast. It is used to determine whether or not a tweak can be applied. Heavy operations should only take place within `apply()`. In current implementation `prepare()` is not fast. E.g. `ReplaceQualifiedWithAlias::prepare()` does full AST traversal (and after that we do this full AST traversal again in `apply()`).
>
> It seems we still traverses the full AST in `ReplaceQualifiedWithAlias::prepare()`, full AST traversal happens inside `collectVisibleContexts()`. And calling `collectVisibleContexts()` inside `ProcessDecl` leads to `O(N^2)` (or maybe `O(N^3)`? because `ProcessDecl` is recursive) complexity at `apply()`.
>
> So, this still looks too heavy to be a tweak, because originally tweak is a fast code action.
Hi @ArcsinX, thank You for the insightful comment. I have fixed the issue mentioned.
https://github.com/llvm/llvm-project/pull/204151
More information about the cfe-commits
mailing list