aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2025-02-21 13:17:06 -0700
committerGitHub <noreply@github.com>2025-02-21 12:17:06 -0800
commitb0f0ac3cad2d43deaf88038eb48c93f5a8c936a7 (patch)
treed18150b6c6516de4427dd7f47fcb3dba6140ae50 /llvm/lib/IR/DIBuilder.cpp
parent45ca39d8e1a2b2cc9d67f7a1999e39dc2f77f342 (diff)
downloadllvm-b0f0ac3cad2d43deaf88038eb48c93f5a8c936a7.zip
llvm-b0f0ac3cad2d43deaf88038eb48c93f5a8c936a7.tar.gz
llvm-b0f0ac3cad2d43deaf88038eb48c93f5a8c936a7.tar.bz2
Add overload of DIBuilder::createArrayType (#125229)
DICompositeType has an attribute representing the name of a type, but currently it isn't possible to set this for array types via the DIBuilder method. This patch adds a new overload of DIBuilder::createArrayType that allows "full" construction of an array type. This is useful for Ada, where arrays are a bit more first-class than C.
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index bbe4d1f..5ed2993 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -601,10 +601,21 @@ DIBuilder::createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty,
PointerUnion<DIExpression *, DIVariable *> AS,
PointerUnion<DIExpression *, DIVariable *> AL,
PointerUnion<DIExpression *, DIVariable *> RK) {
+ return createArrayType(nullptr, StringRef(), nullptr, 0, Size, AlignInBits,
+ Ty, Subscripts, DL, AS, AL, RK);
+}
+
+DICompositeType *DIBuilder::createArrayType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
+ uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
+ PointerUnion<DIExpression *, DIVariable *> DL,
+ PointerUnion<DIExpression *, DIVariable *> AS,
+ PointerUnion<DIExpression *, DIVariable *> AL,
+ PointerUnion<DIExpression *, DIVariable *> RK) {
auto *R = DICompositeType::get(
- VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size,
- AlignInBits, 0, DINode::FlagZero, Subscripts, 0,
- /*EnumKind=*/std::nullopt, nullptr, nullptr, "", nullptr,
+ VMContext, dwarf::DW_TAG_array_type, Name, File, LineNumber,
+ getNonCompileUnitScope(Scope), Ty, Size, AlignInBits, 0, DINode::FlagZero,
+ Subscripts, 0, /*EnumKind=*/std::nullopt, nullptr, nullptr, "", nullptr,
isa<DIExpression *>(DL) ? (Metadata *)cast<DIExpression *>(DL)
: (Metadata *)cast<DIVariable *>(DL),
isa<DIExpression *>(AS) ? (Metadata *)cast<DIExpression *>(AS)