[PATCH] D69162: [clangd] Remove using-namespace present inside a namespace.

UTKARSH SAXENA via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 03:42:48 PDT 2019


usaxena95 created this revision.
usaxena95 added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, mgrang, jkorous, MaskRay.
Herald added a project: clang.

This patch extends the removing using-namespace code action to remove
using-namespace decl that are present inside a namespace.

Goes over all the references that are declared in `TargetNS` and used in
`ContainingNS`. Removes the current qualifer and qualifies it with only
the `TargetNS`. No other qualifier is needed since it was legal to do
`using namespace TargetNS` in the `ContainingNS`. Therefore all
references inside the `ContainingNS` can be qualified with just
`TargetNS`.

Limitations:

- The using decl must be present in TUDecl or directly under NSDecl.
- Only references inside the DeclContext of using-decl are removed. Any

references outisde this DeclContext are retained as is which is
incorrect.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69162

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69162.225589.patch
Type: text/x-patch
Size: 9797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191018/1f91579e/attachment.bin>


More information about the cfe-commits mailing list