[clangd] use printQualifiedName to skip the inlinenamespace qualifiers.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Feb 2020 14:22:56 +0000 (15:22 +0100)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Feb 2020 15:22:45 +0000 (16:22 +0100)
Summary:
symbols in libcpp are inside the inline namespace, printQualifierAsString will
print the inline namespace, which is unexpected.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75174

clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp

index ec33f16..fd2146e 100644 (file)
@@ -110,7 +110,7 @@ bool isBlacklisted(const NamedDecl &RenameDecl) {
 #include "StdSymbolMap.inc"
 #undef SYMBOL
   });
-  return StdSymbols->count(RenameDecl.getQualifiedNameAsString());
+  return StdSymbols->count(printQualifiedName(RenameDecl));
 }
 
 enum ReasonToReject {
index 3b2b96e..9906d6b 100644 (file)
@@ -593,6 +593,14 @@ TEST(RenameTest, Renameable) {
          }
        )cpp",
        "not a supported kind", !HeaderFile, Index},
+      {R"cpp(// disallow rename on blacklisted symbols (e.g. std symbols)
+         namespace std {
+         inline namespace __u {
+         class str^ing {};
+         }
+         }
+       )cpp",
+       "not a supported kind", !HeaderFile, Index},
 
       {R"cpp(
          void foo(int);