[PATCH] D68562: [clangd] Add RemoveUsingNamespace tweak.

UTKARSH SAXENA via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 06:23:19 PDT 2019


usaxena95 added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp:87
+    return false;
+  if (const Decl *ParentDecl = Node->Parent->ASTNode.get<Decl>())
+    return llvm::isa<TranslationUnitDecl>(ParentDecl);
----------------
ilya-biryukov wrote:
> Can we use `ASTNode.get<TranslationUnitDecl>()` to directly to check for this?
> 
> Not sure how `DynTypedNode` works, though, maybe that's impossible.
Works for the test. 
The doc for `get<T>` says that it returns NULL if the stored node does not have a type that is **convertible** to `T`.


================
Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:782
+      int main() {
+        aa::map m;
+      }
----------------
ilya-biryukov wrote:
> This is incorrect, right? We should not be qualifying here.
> See the relevant comment on `isInsideNamespace`
Works fine now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68562





More information about the cfe-commits mailing list