[PATCH] D87775: [clangd] Add option for disabling AddUsing tweak on some namespaces.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 01:02:45 PDT 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks!
Can we add a simple test  to TweakTests (I should really split up that file) and to ConfigCompileTests?

(BTW, do you think we should merge Config{Compile,YAML}Tests?



================
Comment at: clang-tools-extra/clangd/Config.h:70
+    // declarations, always spell out the whole name (with or without leading
+    // ::). All nested namespaces are affected as well.
+    std::vector<std::string> FullyQualifiedNamespaces;
----------------
should just be "without leading ::" now I think?


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp:200
+    StringRef PrefixMatch = NamespaceStr;
+    PrefixMatch.consume_front("::");
+    PrefixMatch.consume_front(Banned);
----------------
not needed - printNamespaceScope never starts with ::


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp:201
+    PrefixMatch.consume_front("::");
+    PrefixMatch.consume_front(Banned);
+    if (PrefixMatch.consume_front("::"))
----------------
inlining this into the if (consume_front(Banned) && consume_front(::)) might be clearer, up to you


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87775



More information about the cfe-commits mailing list