[llvm] r340146 - [C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType
whitequark via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 19 16:39:48 PDT 2018
Author: whitequark
Date: Sun Aug 19 16:39:47 2018
New Revision: 340146
URL: http://llvm.org/viewvc/llvm-project?rev=340146&view=rev
Log:
[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
Modified:
llvm/trunk/bindings/go/llvm/dibuilder.go
llvm/trunk/include/llvm-c/DebugInfo.h
llvm/trunk/lib/IR/DebugInfo.cpp
llvm/trunk/tools/llvm-c-test/debuginfo.c
Modified: llvm/trunk/bindings/go/llvm/dibuilder.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/dibuilder.go?rev=340146&r1=340145&r2=340146&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/dibuilder.go (original)
+++ llvm/trunk/bindings/go/llvm/dibuilder.go Sun Aug 19 16:39:47 2018
@@ -299,6 +299,7 @@ func (d *DIBuilder) CreateBasicType(t DI
C.size_t(len(t.Name)),
C.uint64_t(t.SizeInBits),
C.unsigned(t.Encoding),
+ C.LLVMDIFlags(0),
)
return Metadata{C: result}
}
Modified: llvm/trunk/include/llvm-c/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/DebugInfo.h?rev=340146&r1=340145&r2=340146&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/DebugInfo.h (original)
+++ llvm/trunk/include/llvm-c/DebugInfo.h Sun Aug 19 16:39:47 2018
@@ -57,6 +57,8 @@ typedef enum {
LLVMDIFlagFixedEnum = 1 << 24,
LLVMDIFlagThunk = 1 << 25,
LLVMDIFlagTrivial = 1 << 26,
+ LLVMDIFlagBigEndian = 1 << 27,
+ LLVMDIFlagLittleEndian = 1 << 28,
LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
LLVMDIFlagPublic,
@@ -531,11 +533,13 @@ LLVMDIBuilderCreateUnspecifiedType(LLVMD
* \param NameLen Length of type name.
* \param SizeInBits Size of the type.
* \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
+ * \param Flags Flags to encode optional attribute like endianity
*/
LLVMMetadataRef
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
size_t NameLen, uint64_t SizeInBits,
- LLVMDWARFTypeEncoding Encoding);
+ LLVMDWARFTypeEncoding Encoding,
+ LLVMDIFlags Flags);
/**
* Create debugging information entry for a pointer.
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=340146&r1=340145&r2=340146&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Sun Aug 19 16:39:47 2018
@@ -948,9 +948,11 @@ LLVMDIBuilderCreateVectorType(LLVMDIBuil
LLVMMetadataRef
LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
size_t NameLen, uint64_t SizeInBits,
- LLVMDWARFTypeEncoding Encoding) {
+ LLVMDWARFTypeEncoding Encoding,
+ LLVMDIFlags Flags) {
return wrap(unwrap(Builder)->createBasicType({Name, NameLen},
- SizeInBits, Encoding));
+ SizeInBits, Encoding,
+ map_from_llvmDIFlags(Flags)));
}
LLVMMetadataRef LLVMDIBuilderCreatePointerType(
Modified: llvm/trunk/tools/llvm-c-test/debuginfo.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/debuginfo.c?rev=340146&r1=340145&r2=340146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/debuginfo.c (original)
+++ llvm/trunk/tools/llvm-c-test/debuginfo.c Sun Aug 19 16:39:47 2018
@@ -68,7 +68,7 @@ int llvm_test_dibuilder(void) {
NULL, 0);
LLVMMetadataRef Int64Ty =
- LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0);
+ LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero);
LLVMMetadataRef Int64TypeDef =
LLVMDIBuilderCreateTypedef(DIB, Int64Ty, "int64_t", 7, File, 42, File);
More information about the llvm-commits
mailing list