aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfoMetadata.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2023-11-15 09:36:47 +0000
committerMichael Buch <michaelbuch12@gmail.com>2023-11-15 10:26:35 +0000
commitda90fd75241d5b149fd307e3eeae84f7317d9d9b (patch)
tree43ccb676f24659ac014887478c7bdfbcac356a4c /llvm/lib/IR/DebugInfoMetadata.cpp
parent808caa9d4608b4383743043f6dbdab6faf608bcc (diff)
downloadllvm-da90fd75241d5b149fd307e3eeae84f7317d9d9b.zip
llvm-da90fd75241d5b149fd307e3eeae84f7317d9d9b.tar.gz
llvm-da90fd75241d5b149fd307e3eeae84f7317d9d9b.tar.bz2
Reland "[llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (#72234)"
This was reverted because it broke the OCaml LLVM bindings. Relanding the original patch but without changing the C-API. They'll continue to work just fine as they do today. If in the future there is a need to pass a new tag to the C-API for creating static members, then we'll make the change to the OCaml bindings at that time. Original commit message: """ This patch adds the LLVM-side infrastructure to implement DWARFv5 issue 161118.1: "DW_TAG for C++ static data members". The clang-side of this patch will simply construct the DIDerivedType with a different DW_TAG. """
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 0e14ec9..943826c 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -711,7 +711,9 @@ Constant *DIDerivedType::getStorageOffsetInBits() const {
}
Constant *DIDerivedType::getConstant() const {
- assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
+ assert((getTag() == dwarf::DW_TAG_member ||
+ getTag() == dwarf::DW_TAG_variable) &&
+ isStaticMember());
if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
return C->getValue();
return nullptr;