aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2023-11-15 11:01:39 +0000
committerGitHub <noreply@github.com>2023-11-15 11:01:39 +0000
commitfaa3a5ea9ae481da757dab1c95c589e2d5645982 (patch)
tree887740467a831bc637ff5346cac496f2861f7b38 /clang/lib/CodeGen/CGDebugInfo.cpp
parent1e8c17e9c770d801ef5e9929eb330e30750e38f5 (diff)
downloadllvm-faa3a5ea9ae481da757dab1c95c589e2d5645982.zip
llvm-faa3a5ea9ae481da757dab1c95c589e2d5645982.tar.gz
llvm-faa3a5ea9ae481da757dab1c95c589e2d5645982.tar.bz2
[clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (#72235)
This patch implements the DWARFv5 issue 161118.1: "DW_TAG for C++ static data members". This will simplify LLDB's handling of static data members greatly in the long term since we no longer need to differentiate non-static from static data member declarations using non-portable heuristics. Depends on: * https://github.com/llvm/llvm-project/pull/72234
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index a201cf0..f3de91d 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1679,10 +1679,13 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy,
StringRef VName = Var->getName();
llvm::DINode::DIFlags Flags = getAccessFlag(Var->getAccess(), RD);
+ auto Tag = CGM.getCodeGenOpts().DwarfVersion >= 5
+ ? llvm::dwarf::DW_TAG_variable
+ : llvm::dwarf::DW_TAG_member;
auto Align = getDeclAlignIfRequired(Var, CGM.getContext());
- llvm::DIDerivedType *GV = DBuilder.createStaticMemberType(
- RecordTy, VName, VUnit, LineNumber, VTy, Flags, /* Val */ nullptr,
- llvm::dwarf::DW_TAG_member, Align);
+ llvm::DIDerivedType *GV =
+ DBuilder.createStaticMemberType(RecordTy, VName, VUnit, LineNumber, VTy,
+ Flags, /* Val */ nullptr, Tag, Align);
StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV);
StaticDataMemberDefinitionsToEmit.push_back(Var->getCanonicalDecl());
return GV;