[PATCH] D127629: [clang] Use correct visibility parameters when following a Using declaration
Furkan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 13 03:29:40 PDT 2022
furkanusta created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman.
Herald added a project: All.
furkanusta requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added projects: clang, clang-tools-extra.
Fixes clangd issue #1137
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127629
Files:
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang/lib/Sema/SemaCodeComplete.cpp
Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -1268,7 +1268,9 @@
if (const auto *Using = dyn_cast<UsingShadowDecl>(R.Declaration)) {
CodeCompletionResult Result(Using->getTargetDecl(),
getBasePriority(Using->getTargetDecl()),
- R.Qualifier);
+ R.Qualifier, false,
+ (R.Availability == CXAvailability_Available ||
+ R.Availability == CXAvailability_Deprecated));
Result.ShadowDecl = Using;
AddResult(Result, CurContext, Hiding);
return;
Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -413,6 +413,23 @@
)cpp");
EXPECT_THAT(External.Completions,
AllOf(has("pub"), Not(has("prot")), Not(has("priv"))));
+
+ auto Results = completions(R"cpp(
+ struct Foo {
+ public: void pub();
+ protected: void prot();
+ private: void priv();
+ };
+ struct Bar : public Foo {
+ private: using Foo::pub;
+ };
+ void test() {
+ Bar B;
+ B.^
+ }
+ )cpp");
+ EXPECT_THAT(Results.Completions,
+ AllOf(Not(has("priv")), Not(has("prot")), Not(has("pub"))));
}
TEST(CompletionTest, Qualifiers) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127629.436331.patch
Type: text/x-patch
Size: 1621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220613/52074acc/attachment-0001.bin>
More information about the cfe-commits
mailing list