[PATCH] D137817: [clangd] Improve action `RemoveUsingNamespace` for user-defined literals

Vincent Hong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 17 07:37:28 PST 2022


v1nh1shungry updated this revision to Diff 483749.
v1nh1shungry added a comment.

Note:
Currently if there are user-defined literals, this patch will find them and get their
`CompoundStmt` parents. If there is one, it will record the parent so that it can add the
using-declaration in it later. If there is not, it means the user-defined literal is in
the top-level, and it is reasonable to do nothing for it. I choose `CompoundStmt` because
it covers many cases, like blocks, functions, lambdas.

Since I failed to find a way to use only `ReferenceLoc` to get the parents, I have to
traverse the whole `Decl` again to find out the `DeclRefExpr` and then use `ASTContext`
to get its parents. Also this implementation can cause redundance in some cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137817/new/

https://reviews.llvm.org/D137817

Files:
  clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
  clang-tools-extra/clangd/unittests/tweaks/RemoveUsingNamespaceTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137817.483749.patch
Type: text/x-patch
Size: 8059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221217/1605475e/attachment.bin>


More information about the cfe-commits mailing list