Fix LLVM 5.0 compilation

This commit is contained in:
Johan Engelen 2017-03-14 23:45:56 +01:00
parent a75c84ab06
commit c2b539c348

View file

@ -289,9 +289,18 @@ ldc::DIType ldc::DIBuilder::CreatePointerType(Type *type) {
if (nt->toBasetype()->ty == Tvoid) if (nt->toBasetype()->ty == Tvoid)
nt = Type::tuns8; nt = Type::tuns8;
#if LDC_LLVM_VER >= 500
// TODO: The addressspace is important for dcompute targets.
// See e.g. https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00326.html
const llvm::Optional<unsigned> DWARFAddressSpace = llvm::None;
#endif
return DBuilder.createPointerType(CreateTypeDescription(nt, false), return DBuilder.createPointerType(CreateTypeDescription(nt, false),
getTypeAllocSize(T) * 8, // size (bits) getTypeAllocSize(T) * 8, // size (bits)
getABITypeAlign(T) * 8, // align (bits) getABITypeAlign(T) * 8, // align (bits)
#if LDC_LLVM_VER >= 500
DWARFAddressSpace,
#endif
type->toChars() // name type->toChars() // name
); );
} }
@ -692,7 +701,12 @@ ldc::DIType ldc::DIBuilder::CreateTypeDescription(Type *type, bool derefclass) {
#endif #endif
if (t->ty == Tnull) // display null as void* if (t->ty == Tnull) // display null as void*
return DBuilder.createPointerType(CreateTypeDescription(Type::tvoid, false), return DBuilder.createPointerType(CreateTypeDescription(Type::tvoid, false),
8, 8, "typeof(null)"); 8, 8,
#if LDC_LLVM_VER >= 500
/* DWARFAddressSpace */ llvm::None,
#endif
"typeof(null)");
if (t->ty == Tvector) if (t->ty == Tvector)
return CreateVectorType(type); return CreateVectorType(type);
if (t->isintegral() || t->isfloating()) { if (t->isintegral() || t->isfloating()) {