aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2025-02-07 09:28:10 +0000
committerGitHub <noreply@github.com>2025-02-07 09:28:10 +0000
commite00fc80c194b3742cd387b7cc74a5fd7ab775bf0 (patch)
tree9fdaf5e9e1808711007bf98e65e7316aa5567ca3 /clang/lib/CodeGen/CGDebugInfo.cpp
parent1608fe8d56015719d5bf7abca608adad8a866f43 (diff)
downloadllvm-e00fc80c194b3742cd387b7cc74a5fd7ab775bf0.zip
llvm-e00fc80c194b3742cd387b7cc74a5fd7ab775bf0.tar.gz
llvm-e00fc80c194b3742cd387b7cc74a5fd7ab775bf0.tar.bz2
[clang][DebugInfo] Set EnumKind based on enum_extensibility attribute (#126045)
This is the 2nd part to https://github.com/llvm/llvm-project/pull/124752. Here we make sure to set the `DICompositeType` `EnumKind` if the enum was declared with `__attribute__((enum_extensibility(...)))`. In DWARF this will be rendered as `DW_AT_APPLE_enum_kind` and will be used by LLDB when creating `clang::EnumDecl`s from debug-info. Depends on https://github.com/llvm/llvm-project/pull/126044
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index db59579..d5b584e 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3567,6 +3567,10 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
DBuilder.createEnumerator(Enum->getName(), Enum->getInitVal()));
}
+ std::optional<EnumExtensibilityAttr::Kind> EnumKind;
+ if (auto *Attr = ED->getAttr<EnumExtensibilityAttr>())
+ EnumKind = Attr->getExtensibility();
+
// Return a CompositeType for the enum itself.
llvm::DINodeArray EltArray = DBuilder.getOrCreateArray(Enumerators);
@@ -3576,7 +3580,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
llvm::DIType *ClassTy = getOrCreateType(ED->getIntegerType(), DefUnit);
return DBuilder.createEnumerationType(
EnumContext, ED->getName(), DefUnit, Line, Size, Align, EltArray, ClassTy,
- /*RunTimeLang=*/0, Identifier, ED->isScoped());
+ /*RunTimeLang=*/0, Identifier, ED->isScoped(), EnumKind);
}
llvm::DIMacro *CGDebugInfo::CreateMacro(llvm::DIMacroFile *Parent,