[Lldb-commits] [lldb] [lldb][TypeSystemClang] Set access specifier for EnumConstantDecl's (PR #174865)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 7 13:32:06 PST 2026
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/174865
LLDB was already setting the access specifier on `EnumDecl`s unconditionally to `AS_public`. But it wasn't doing so for the `EnumConstantDecl`s. This triggered a Clang assertion during auto-completion of expressions (https://github.com/llvm/llvm-project/issues/171913).
Ideally the code-completion accessibility check would honor the `AccessControl` language option, but that change is harder to test/justify. Since this is a pretty straight-forward change I want to land this before trying to do this.
There is no test coverage for this because it relies on the order in which Clang decides to check the decls in scope for auto-completion, which seems fragile. It's also consistent with how we handle access to other decls in `TypeSystemClang`.
Fixes https://github.com/llvm/llvm-project/issues/171913
>From bf2ea76c72197b88e749a59da9146fcaa3a2505a Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Wed, 7 Jan 2026 21:26:12 +0000
Subject: [PATCH] [lldb][TypeSystemClang] Set access specifier for
EnumConstantDecl's
LLDB was already setting the access specifier on `EnumDecl`s unconditionally to `AS_public`. But it wasn't doing so for the `EnumConstantDecl`s. This triggered a Clang assertion during auto-completion of expressions (https://github.com/llvm/llvm-project/issues/171913).
Ideally the code-completion accessibility check would honor the `AccessControl` language option, but that change is harder to test/justify. Since this is a pretty straight-forward change I want to land this before trying to do this.
There is no test coverage for this because it relies on the order in which Clang decides to check the decls in scope for auto-completion, which seems fragile. It's also consistent with how we handle access to other decls in `TypeSystemClang`.
Fixes https://github.com/llvm/llvm-project/issues/171913
---
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3bb3bf3a8d127..89c860878622c 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8594,6 +8594,7 @@ clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
enumerator_decl->setDeclName(&getASTContext().Idents.get(name));
enumerator_decl->setType(clang::QualType(enutype, 0));
enumerator_decl->setInitVal(getASTContext(), value);
+ enumerator_decl->setAccess(AS_public);
SetMemberOwningModule(enumerator_decl, enum_decl);
if (!enumerator_decl)
More information about the lldb-commits
mailing list