mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-06 01:31:56 +00:00
[C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType
Added DIFlags in LLVMDIBuilderCreateBasicType to add optional DWARF attributes, such as DW_AT_endianity. Patch by Chirag Patel. Differential Revision: https://reviews.llvm.org/D50832 llvm-svn: 340146
This commit is contained in:
parent
3762bd1fe5
commit
b8bf292fc1
@ -299,6 +299,7 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {
|
|||||||
C.size_t(len(t.Name)),
|
C.size_t(len(t.Name)),
|
||||||
C.uint64_t(t.SizeInBits),
|
C.uint64_t(t.SizeInBits),
|
||||||
C.unsigned(t.Encoding),
|
C.unsigned(t.Encoding),
|
||||||
|
C.LLVMDIFlags(0),
|
||||||
)
|
)
|
||||||
return Metadata{C: result}
|
return Metadata{C: result}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,8 @@ typedef enum {
|
|||||||
LLVMDIFlagFixedEnum = 1 << 24,
|
LLVMDIFlagFixedEnum = 1 << 24,
|
||||||
LLVMDIFlagThunk = 1 << 25,
|
LLVMDIFlagThunk = 1 << 25,
|
||||||
LLVMDIFlagTrivial = 1 << 26,
|
LLVMDIFlagTrivial = 1 << 26,
|
||||||
|
LLVMDIFlagBigEndian = 1 << 27,
|
||||||
|
LLVMDIFlagLittleEndian = 1 << 28,
|
||||||
LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
|
LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
|
||||||
LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
|
LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
|
||||||
LLVMDIFlagPublic,
|
LLVMDIFlagPublic,
|
||||||
@ -531,11 +533,13 @@ LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name,
|
|||||||
* \param NameLen Length of type name.
|
* \param NameLen Length of type name.
|
||||||
* \param SizeInBits Size of the type.
|
* \param SizeInBits Size of the type.
|
||||||
* \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
|
* \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
|
||||||
|
* \param Flags Flags to encode optional attribute like endianity
|
||||||
*/
|
*/
|
||||||
LLVMMetadataRef
|
LLVMMetadataRef
|
||||||
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
|
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
|
||||||
size_t NameLen, uint64_t SizeInBits,
|
size_t NameLen, uint64_t SizeInBits,
|
||||||
LLVMDWARFTypeEncoding Encoding);
|
LLVMDWARFTypeEncoding Encoding,
|
||||||
|
LLVMDIFlags Flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create debugging information entry for a pointer.
|
* Create debugging information entry for a pointer.
|
||||||
|
@ -948,9 +948,11 @@ LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size,
|
|||||||
LLVMMetadataRef
|
LLVMMetadataRef
|
||||||
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
|
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
|
||||||
size_t NameLen, uint64_t SizeInBits,
|
size_t NameLen, uint64_t SizeInBits,
|
||||||
LLVMDWARFTypeEncoding Encoding) {
|
LLVMDWARFTypeEncoding Encoding,
|
||||||
|
LLVMDIFlags Flags) {
|
||||||
return wrap(unwrap(Builder)->createBasicType({Name, NameLen},
|
return wrap(unwrap(Builder)->createBasicType({Name, NameLen},
|
||||||
SizeInBits, Encoding));
|
SizeInBits, Encoding,
|
||||||
|
map_from_llvmDIFlags(Flags)));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMMetadataRef LLVMDIBuilderCreatePointerType(
|
LLVMMetadataRef LLVMDIBuilderCreatePointerType(
|
||||||
|
@ -68,7 +68,7 @@ int llvm_test_dibuilder(void) {
|
|||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
|
||||||
LLVMMetadataRef Int64Ty =
|
LLVMMetadataRef Int64Ty =
|
||||||
LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0);
|
LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero);
|
||||||
LLVMMetadataRef Int64TypeDef =
|
LLVMMetadataRef Int64TypeDef =
|
||||||
LLVMDIBuilderCreateTypedef(DIB, Int64Ty, "int64_t", 7, File, 42, File);
|
LLVMDIBuilderCreateTypedef(DIB, Int64Ty, "int64_t", 7, File, 42, File);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user