[clang-tools-extra] 02323a3 - [clangd] use printQualifiedName to skip the inlinenamespace qualifiers.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 07:23:23 PST 2020
Author: Haojian Wu
Date: 2020-02-26T16:22:45+01:00
New Revision: 02323a3d5f9ea676865f78d603e68fa4b4b62608
URL: https://github.com/llvm/llvm-project/commit/02323a3d5f9ea676865f78d603e68fa4b4b62608
DIFF: https://github.com/llvm/llvm-project/commit/02323a3d5f9ea676865f78d603e68fa4b4b62608.diff
LOG: [clangd] use printQualifiedName to skip the inlinenamespace qualifiers.
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
Added:
Modified:
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index ec33f16eac05..fd2146eb4fb7 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -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 {
diff --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 3b2b96e51dd1..9906d6b3c29d 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -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);
More information about the cfe-commits
mailing list