[clang] [Clang] prevent setting default lexical access specifier for missing primary declarations (PR #112424)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 09:24:59 PDT 2024


================
@@ -39,7 +39,8 @@ bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl,
                                     AccessSpecifier LexicalAS) {
   if (!PrevMemberDecl) {
     // Use the lexical access specifier.
-    MemberDecl->setAccess(LexicalAS);
----------------
a-tarasyuk wrote:

@shafik https://github.com/llvm/llvm-project/issues/112208#issuecomment-2411881773 when `PrevMemberDecl` exists but isn't equal to `LexicalAS` — with `AS_none` excluded

https://github.com/llvm/llvm-project/blob/020566701030425f44eb80387d0ae76c5a867aa9/clang/lib/Sema/SemaAccess.cpp#L48

 I suppose `AS_none` should be excluded when `PrevMemberDecl` is unknown. What do you think?

https://github.com/llvm/llvm-project/pull/112424


More information about the cfe-commits mailing list