[PATCH] D127629: [clang] Use correct visibility parameters when following a Using declaration
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 15 06:53:30 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG462def25ec13: [clang] Use correct visibility parameters when following a Using declaration (authored by furkanusta, committed by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127629/new/
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
@@ -1095,7 +1095,9 @@
if (const UsingShadowDecl *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;
MaybeAddResult(Result, CurContext);
return;
@@ -1268,7 +1270,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.437142.patch
Type: text/x-patch
Size: 2203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220615/e599b54f/attachment.bin>
More information about the cfe-commits
mailing list