Skip to content

Commit d681097

Browse files
committed
Add support for creating a SetType, a Subrangetype, a dynamic array type
and for replacing arrays to the C inteface
1 parent 423f6f4 commit d681097

File tree

2 files changed

+28
-32
lines changed

2 files changed

+28
-32
lines changed

llvm/include/llvm-c/DebugInfo.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -690,15 +690,15 @@ LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
690690

691691
/**
692692
* Create debugging information entry for a set.
693-
* @param Builder The DIBuilder.
694-
* \param Scope The scope this module is imported into.
693+
* \param Builder The DIBuilder.
694+
* \param Scope The scope in which the set is defined.
695695
* \param Name A name that uniquely identifies this set.
696696
* \param NameLen The length of the C string passed to \c Name.
697697
* \param File File where the set is located.
698698
* \param Line Line number of the declaration.
699699
* \param SizeInBits Set size.
700700
* \param AlignInBits Set alignment.
701-
* @param BaseTy The base type of the set.
701+
* \param BaseTy The base type of the set.
702702
*/
703703
LLVMMetadataRef LLVMDIBuilderCreateSetType(
704704
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
@@ -708,8 +708,8 @@ LLVMMetadataRef LLVMDIBuilderCreateSetType(
708708
/**
709709
* Create a descriptor for a subrange with dynamic bounds.
710710
* \param Builder The DIBuilder.
711-
* \param Scope The scope this module is imported into.
712-
* \param Name A name that uniquely identifies this set.
711+
* \param Scope The scope in which the subrange is defined.
712+
* \param Name A name that uniquely identifies this subrange.
713713
* \param NameLen The length of the C string passed to \c Name.
714714
* \param LineNo Line number.
715715
* \param File File where the subrange is located.
@@ -724,9 +724,8 @@ LLVMMetadataRef LLVMDIBuilderCreateSetType(
724724
*/
725725
LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
726726
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
727-
size_t NameLen, unsigned LineNo, LLVMMetadataRef File,
728-
uint64_t SizeInBits, uint32_t AlignInBits,
729-
LLVMDIFlags Flags, LLVMMetadataRef BaseTy,
727+
size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t SizeInBits,
728+
uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef BaseTy,
730729
LLVMMetadataRef LowerBound, LLVMMetadataRef UpperBound,
731730
LLVMMetadataRef Stride, LLVMMetadataRef Bias);
732731

@@ -746,11 +745,11 @@ LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
746745
*/
747746
LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
748747
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
749-
size_t NameLen, unsigned LineNo, LLVMMetadataRef File,
750-
uint64_t Size, uint32_t AlignInBits,
751-
LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts,
752-
LLVMMetadataRef DataLocation, LLVMMetadataRef Associated,
753-
LLVMMetadataRef Allocated, LLVMMetadataRef Rank, LLVMMetadataRef BitStride);
748+
size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t Size,
749+
uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts,
750+
unsigned NumSubscripts, LLVMMetadataRef DataLocation,
751+
LLVMMetadataRef Associated, LLVMMetadataRef Allocated, LLVMMetadataRef Rank,
752+
LLVMMetadataRef BitStride);
754753

755754
/**
756755
* Replace arrays.

llvm/lib/IR/DebugInfo.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,32 +1320,29 @@ LLVMMetadataRef LLVMDIBuilderCreateSetType(
13201320

13211321
LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
13221322
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1323-
size_t NameLen, unsigned LineNo, LLVMMetadataRef File,
1324-
uint64_t SizeInBits, uint32_t AlignInBits,
1325-
LLVMDIFlags Flags, LLVMMetadataRef BaseTy,
1323+
size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t SizeInBits,
1324+
uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef BaseTy,
13261325
LLVMMetadataRef LowerBound, LLVMMetadataRef UpperBound,
1327-
LLVMMetadataRef Stride, LLVMMetadataRef Bias
1328-
) {
1326+
LLVMMetadataRef Stride, LLVMMetadataRef Bias) {
13291327
return wrap(unwrap(Builder)->createSubrangeType(
1330-
{Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
1331-
unwrapDI<DIScope>(Scope), SizeInBits, AlignInBits,
1332-
map_from_llvmDIFlags(Flags), unwrapDI<DIType>(BaseTy),
1333-
unwrap<DIExpression>(LowerBound), unwrap<DIExpression>(UpperBound),
1334-
unwrap<DIExpression>(Stride), unwrap<DIExpression>(Bias)));
1328+
{Name, NameLen}, unwrapDI<DIFile>(File), LineNo, unwrapDI<DIScope>(Scope),
1329+
SizeInBits, AlignInBits, map_from_llvmDIFlags(Flags),
1330+
unwrapDI<DIType>(BaseTy), unwrap<DIExpression>(LowerBound),
1331+
unwrap<DIExpression>(UpperBound), unwrap<DIExpression>(Stride),
1332+
unwrap<DIExpression>(Bias)));
13351333
}
13361334

13371335
LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
13381336
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1339-
size_t NameLen, unsigned LineNo, LLVMMetadataRef File,
1340-
uint64_t Size, uint32_t AlignInBits,
1341-
LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts,
1342-
LLVMMetadataRef DataLocation, LLVMMetadataRef Associated,
1343-
LLVMMetadataRef Allocated, LLVMMetadataRef Rank, LLVMMetadataRef BitStride) {
1337+
size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t Size,
1338+
uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts,
1339+
unsigned NumSubscripts, LLVMMetadataRef DataLocation,
1340+
LLVMMetadataRef Associated, LLVMMetadataRef Allocated, LLVMMetadataRef Rank,
1341+
LLVMMetadataRef BitStride) {
13441342
auto Subs =
13451343
unwrap(Builder)->getOrCreateArray({unwrap(Subscripts), NumSubscripts});
13461344
return wrap(unwrap(Builder)->createArrayType(
1347-
unwrapDI<DIScope>(Scope),
1348-
{Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
1345+
unwrapDI<DIScope>(Scope), {Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
13491346
Size, AlignInBits, unwrapDI<DIType>(Ty), Subs,
13501347
unwrap<DIExpression>(DataLocation), unwrap<DIExpression>(Associated),
13511348
unwrap<DIExpression>(Allocated), unwrap<DIExpression>(Rank),
@@ -1355,8 +1352,8 @@ LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
13551352
void LLVMReplaceArrays(LLVMDIBuilderRef Builder, LLVMMetadataRef *T,
13561353
LLVMMetadataRef *Elements, unsigned NumElements) {
13571354
auto Arr = unwrap<DICompositeType>(*T);
1358-
auto Elts = unwrap(Builder)->getOrCreateArray({unwrap(Elements),
1359-
NumElements});
1355+
auto Elts =
1356+
unwrap(Builder)->getOrCreateArray({unwrap(Elements), NumElements});
13601357
unwrap(Builder)->replaceArrays(Arr, Elts);
13611358
}
13621359

0 commit comments

Comments
 (0)