LLVM debug info fix, again
This commit is contained in:
206
type.cpp
206
type.cpp
@@ -77,10 +77,13 @@ lShouldPrintName(const std::string &name) {
|
||||
}
|
||||
|
||||
|
||||
/** Utility routine to create a llvm DIArray type of the given number of
|
||||
/** Utility routine to create a llvm array type of the given number of
|
||||
the given element type. */
|
||||
static llvm::DIType
|
||||
lCreateDIArray(llvm::DIType eltType, int count) {
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
static llvm::DIType lCreateDIArray(llvm::DIType eltType, int count) {
|
||||
#else // LLVM 3.7++
|
||||
static llvm::MDType *lCreateDIArray(llvm::MDType *eltType, int count) {
|
||||
#endif
|
||||
#ifdef LLVM_3_2
|
||||
int lowerBound = 0, upperBound = count-1;
|
||||
|
||||
@@ -102,12 +105,13 @@ lCreateDIArray(llvm::DIType eltType, int count) {
|
||||
std::vector<llvm::Metadata *> subs;
|
||||
#endif
|
||||
subs.push_back(sub);
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(subs);
|
||||
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(subs);
|
||||
uint64_t size = eltType.getSizeInBits() * count;
|
||||
uint64_t align = eltType.getAlignInBits();
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(subs);
|
||||
uint64_t size = eltType->getSizeInBits() * count;
|
||||
uint64_t align = eltType->getAlignInBits();
|
||||
#endif
|
||||
@@ -521,14 +525,21 @@ AtomicType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
AtomicType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType AtomicType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *AtomicType::GetDIType(llvm::MDScope *scope) const {
|
||||
#endif
|
||||
Assert(variability.type != Variability::Unbound);
|
||||
|
||||
if (variability.type == Variability::Uniform) {
|
||||
switch (basicType) {
|
||||
case TYPE_VOID:
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DIType();
|
||||
#else //LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
case TYPE_BOOL:
|
||||
return m->diBuilder->createBasicType("bool", 32 /* size */, 32 /* align */,
|
||||
llvm::dwarf::DW_ATE_unsigned);
|
||||
@@ -575,11 +586,14 @@ AtomicType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
break;
|
||||
default:
|
||||
FATAL("unhandled basic type in AtomicType::GetDIType()");
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DIType();
|
||||
#else //LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (variability == Variability::Varying) {
|
||||
llvm::DIType unifType = GetAsUniformType()->GetDIType(scope);
|
||||
#ifdef LLVM_3_2
|
||||
llvm::Value *sub = m->diBuilder->getOrCreateSubrange(0, g->target->getVectorWidth()-1);
|
||||
#elif defined (LLVM_3_3)|| defined (LLVM_3_4) || defined (LLVM_3_5)
|
||||
@@ -587,11 +601,14 @@ AtomicType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else // LLVM 3.6++
|
||||
llvm::Metadata *sub = m->diBuilder->getOrCreateSubrange(0, g->target->getVectorWidth());
|
||||
#endif
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
#if defined (LLVM_3_3)|| defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
llvm::DIType unifType = GetAsUniformType()->GetDIType(scope);
|
||||
uint64_t size = unifType.getSizeInBits() * g->target->getVectorWidth();
|
||||
uint64_t align = unifType.getAlignInBits() * g->target->getVectorWidth();
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
llvm::MDType *unifType = GetAsUniformType()->GetDIType(scope);
|
||||
uint64_t size = unifType->getSizeInBits() * g->target->getVectorWidth();
|
||||
uint64_t align = unifType->getAlignInBits()* g->target->getVectorWidth();
|
||||
#endif
|
||||
@@ -827,8 +844,12 @@ EnumType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else // LLVM 3.7++
|
||||
llvm::MDType *EnumType::GetDIType(llvm::MDScope *scope) const {
|
||||
#endif
|
||||
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5)
|
||||
std::vector<llvm::Value *> enumeratorDescriptors;
|
||||
#else // LLVM 3.6++
|
||||
@@ -847,19 +868,25 @@ EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
m->diBuilder->createEnumerator(enumerators[i]->name, enumeratorValue);
|
||||
enumeratorDescriptors.push_back(descriptor);
|
||||
}
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIArray elementArray =
|
||||
m->diBuilder->getOrCreateArray(enumeratorDescriptors);
|
||||
|
||||
llvm::DIFile diFile = pos.GetDIFile();
|
||||
llvm::DIType diType =
|
||||
m->diBuilder->createEnumerationType(diFile, name, diFile, pos.first_line,
|
||||
32 /* size in bits */,
|
||||
32 /* align in bits */,
|
||||
elementArray
|
||||
, llvm::DIType()
|
||||
);
|
||||
|
||||
|
||||
elementArray, llvm::DIType());
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray elementArray =
|
||||
m->diBuilder->getOrCreateArray(enumeratorDescriptors);
|
||||
llvm::MDFile *diFile = pos.GetDIFile();
|
||||
llvm::MDType *diType =
|
||||
m->diBuilder->createEnumerationType(diFile, name, diFile, pos.first_line,
|
||||
32 /* size in bits */,
|
||||
32 /* align in bits */,
|
||||
elementArray, NULL);
|
||||
#endif
|
||||
switch (variability.type) {
|
||||
case Variability::Uniform:
|
||||
return diType;
|
||||
@@ -871,11 +898,12 @@ EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else // LLVM 3.6++
|
||||
llvm::Metadata *sub = m->diBuilder->getOrCreateSubrange(0, g->target->getVectorWidth());
|
||||
#endif
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
#if defined (LLVM_3_3)|| defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
uint64_t size = diType.getSizeInBits() * g->target->getVectorWidth();
|
||||
uint64_t align = diType.getAlignInBits() * g->target->getVectorWidth();
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
uint64_t size = diType->getSizeInBits() * g->target->getVectorWidth();
|
||||
uint64_t align = diType->getAlignInBits()* g->target->getVectorWidth();
|
||||
#endif
|
||||
@@ -886,7 +914,11 @@ EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
}
|
||||
default:
|
||||
FATAL("Unexpected variability in EnumType::GetDIType()");
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DIType();
|
||||
#else //LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,14 +1252,21 @@ PointerType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
PointerType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType PointerType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
if (baseType == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return llvm::DIType();
|
||||
}
|
||||
|
||||
llvm::DIType diTargetType = baseType->GetDIType(scope);
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *PointerType::GetDIType(llvm::MDScope *scope) const {
|
||||
if (baseType == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
llvm::MDType *diTargetType = baseType->GetDIType(scope);
|
||||
#endif
|
||||
int bitsSize = g->target->is32Bit() ? 32 : 64;
|
||||
int ptrAlignBits = bitsSize;
|
||||
switch (variability.type) {
|
||||
@@ -1236,8 +1275,11 @@ PointerType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
ptrAlignBits);
|
||||
case Variability::Varying: {
|
||||
// emit them as an array of pointers
|
||||
llvm::DIType eltType = m->diBuilder->createPointerType(diTargetType,
|
||||
bitsSize, ptrAlignBits);
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDDerivedType *eltType =
|
||||
m->diBuilder->createPointerType(diTargetType, bitsSize, ptrAlignBits);
|
||||
#endif
|
||||
return lCreateDIArray(eltType, g->target->getVectorWidth());
|
||||
}
|
||||
case Variability::SOA: {
|
||||
@@ -1246,7 +1288,11 @@ PointerType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
}
|
||||
default:
|
||||
FATAL("Unexpected variability in PointerType::GetDIType()");
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DIType();
|
||||
#else //LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1520,14 +1566,21 @@ ArrayType::TotalElementCount() const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
ArrayType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType ArrayType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
if (child == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return llvm::DIType();
|
||||
}
|
||||
|
||||
llvm::DIType eltType = child->GetDIType(scope);
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *ArrayType::GetDIType(llvm::MDScope *scope) const {
|
||||
if (child == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
llvm::MDType *eltType = child->GetDIType(scope);
|
||||
#endif
|
||||
return lCreateDIArray(eltType, numElements);
|
||||
}
|
||||
|
||||
@@ -1762,9 +1815,13 @@ VectorType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
VectorType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType VectorType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
llvm::DIType eltType = base->GetDIType(scope);
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *VectorType::GetDIType(llvm::MDScope *scope) const {
|
||||
llvm::MDType *eltType = base->GetDIType(scope);
|
||||
#endif
|
||||
#ifdef LLVM_3_2
|
||||
llvm::Value *sub = m->diBuilder->getOrCreateSubrange(0, numElements-1);
|
||||
#elif defined (LLVM_3_3)|| defined (LLVM_3_4) || defined (LLVM_3_5)
|
||||
@@ -1772,15 +1829,16 @@ VectorType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else // LLVM 3.6++
|
||||
llvm::Metadata *sub = m->diBuilder->getOrCreateSubrange(0, numElements);
|
||||
#endif
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
|
||||
// vectors of varying types are already naturally aligned to the
|
||||
// machine's vector width, but arrays of uniform types need to be
|
||||
// explicitly aligned to the machines natural vector alignment.
|
||||
#if defined (LLVM_3_3)|| defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
uint64_t sizeBits = eltType.getSizeInBits() * numElements;
|
||||
uint64_t align = eltType.getAlignInBits();
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(sub);
|
||||
uint64_t sizeBits = eltType->getSizeInBits() * numElements;
|
||||
uint64_t align = eltType->getAlignInBits();
|
||||
#endif
|
||||
@@ -1796,7 +1854,11 @@ VectorType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
}
|
||||
else {
|
||||
FATAL("Unexpected variability in VectorType::GetDIType()");
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DIType();
|
||||
#else // LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2196,8 +2258,11 @@ StructType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *StructType::GetDIType(llvm::MDScope *scope) const {
|
||||
#endif
|
||||
uint64_t currentSize = 0, align = 0;
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5)
|
||||
std::vector<llvm::Value *> elementLLVMTypes;
|
||||
@@ -2208,11 +2273,12 @@ StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
// alignment and size, using that to figure out its offset w.r.t. the
|
||||
// start of the structure.
|
||||
for (unsigned int i = 0; i < elementTypes.size(); ++i) {
|
||||
llvm::DIType eltType = GetElementType(i)->GetDIType(scope);
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIType eltType = GetElementType(i)->GetDIType(scope);
|
||||
uint64_t eltAlign = eltType.getAlignInBits();
|
||||
uint64_t eltSize = eltType.getSizeInBits();
|
||||
#else // LLVM 3.7++
|
||||
llvm::MDType *eltType = GetElementType(i)->GetDIType(scope);
|
||||
uint64_t eltAlign = eltType->getAlignInBits();
|
||||
uint64_t eltSize = eltType->getSizeInBits();
|
||||
#endif
|
||||
@@ -2228,9 +2294,14 @@ StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
currentSize += eltAlign - (currentSize % eltAlign);
|
||||
Assert((currentSize == 0) || (currentSize % eltAlign) == 0);
|
||||
|
||||
llvm::DIFile diFile = elementPositions[i].GetDIFile();
|
||||
int line = elementPositions[i].first_line;
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIFile diFile = elementPositions[i].GetDIFile();
|
||||
llvm::DIType fieldType =
|
||||
#else // LLVM 3.7++
|
||||
llvm::MDFile *diFile = elementPositions[i].GetDIFile();
|
||||
llvm::MDDerivedType *fieldType =
|
||||
#endif
|
||||
m->diBuilder->createMemberType(scope, elementNames[i], diFile,
|
||||
line, eltSize, eltAlign,
|
||||
currentSize, 0, eltType);
|
||||
@@ -2244,8 +2315,13 @@ StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
if (currentSize > 0 && (currentSize % align))
|
||||
currentSize += align - (currentSize % align);
|
||||
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5) || defined (LLVM_3_6)
|
||||
llvm::DIArray elements = m->diBuilder->getOrCreateArray(elementLLVMTypes);
|
||||
llvm::DIFile diFile = pos.GetDIFile();
|
||||
#else // LLVM 3.7++
|
||||
llvm::DebugNodeArray elements = m->diBuilder->getOrCreateArray(elementLLVMTypes);
|
||||
llvm::MDFile *diFile = pos.GetDIFile();
|
||||
#endif
|
||||
return m->diBuilder->createStructType(
|
||||
diFile,
|
||||
name,
|
||||
@@ -2254,8 +2330,10 @@ StructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
currentSize, // Size in bits
|
||||
align, // Alignment in bits
|
||||
0, // Flags
|
||||
#if !defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType(), // DerivedFrom
|
||||
#elif !defined(LLVM_3_2) // LLVM 3.7++
|
||||
NULL,
|
||||
#endif
|
||||
elements);
|
||||
}
|
||||
@@ -2485,10 +2563,15 @@ UndefinedStructType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
UndefinedStructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType UndefinedStructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
llvm::DIFile diFile = pos.GetDIFile();
|
||||
llvm::DIArray elements;
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *UndefinedStructType::GetDIType(llvm::MDScope *scope) const {
|
||||
llvm::MDFile *diFile = pos.GetDIFile();
|
||||
llvm::DebugNodeArray elements;
|
||||
#endif
|
||||
return m->diBuilder->createStructType(
|
||||
diFile,
|
||||
name,
|
||||
@@ -2497,8 +2580,10 @@ UndefinedStructType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
0, // Size
|
||||
0, // Align
|
||||
0, // Flags
|
||||
#if !defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType(), // DerivedFrom
|
||||
#elif !defined(LLVM_3_2) // LLVM 3.7++
|
||||
NULL,
|
||||
#endif
|
||||
elements);
|
||||
}
|
||||
@@ -2752,14 +2837,21 @@ ReferenceType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
ReferenceType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType ReferenceType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
if (targetType == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return llvm::DIType();
|
||||
}
|
||||
|
||||
llvm::DIType diTargetType = targetType->GetDIType(scope);
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *ReferenceType::GetDIType(llvm::MDScope *scope) const {
|
||||
if (targetType == NULL) {
|
||||
Assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
llvm::MDType *diTargetType = targetType->GetDIType(scope);
|
||||
#endif
|
||||
return m->diBuilder->createReferenceType(llvm::dwarf::DW_TAG_reference_type,
|
||||
diTargetType);
|
||||
}
|
||||
@@ -3024,8 +3116,12 @@ FunctionType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||
}
|
||||
|
||||
|
||||
llvm::DIType
|
||||
FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
llvm::DIType FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
#else //LLVM 3.7++
|
||||
llvm::MDType *FunctionType::GetDIType(llvm::MDScope *scope) const {
|
||||
#endif
|
||||
|
||||
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5)
|
||||
std::vector<llvm::Value *> retArgTypes;
|
||||
#else // LLVM 3.6++
|
||||
@@ -3036,25 +3132,33 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
const Type *t = GetParameterType(i);
|
||||
if (t == NULL)
|
||||
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)// LLVM 3.4+
|
||||
return llvm::DICompositeType();
|
||||
#else
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||
return llvm::DIType();
|
||||
#elif defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
return llvm::DICompositeType();
|
||||
#else // LLVM 3.7++
|
||||
return NULL;
|
||||
#endif
|
||||
retArgTypes.push_back(t->GetDIType(scope));
|
||||
}
|
||||
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) // LLVM 3.6+
|
||||
llvm::DITypeArray retArgTypesArray =
|
||||
m->diBuilder->getOrCreateTypeArray(retArgTypes);
|
||||
#else
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5)
|
||||
llvm::DIArray retArgTypesArray =
|
||||
m->diBuilder->getOrCreateArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
|
||||
#endif
|
||||
|
||||
llvm::DIType diType =
|
||||
// FIXME: DIFile
|
||||
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);
|
||||
#elif defined(LLVM_3_6)
|
||||
llvm::DITypeArray retArgTypesArray =
|
||||
m->diBuilder->getOrCreateTypeArray(retArgTypes);
|
||||
llvm::DIType diType =
|
||||
// FIXME: DIFile
|
||||
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);
|
||||
#else // LLVM 3.7++
|
||||
llvm::MDTypeRefArray retArgTypesArray =
|
||||
m->diBuilder->getOrCreateTypeArray(retArgTypes);
|
||||
llvm::MDType *diType =
|
||||
m->diBuilder->createSubroutineType(NULL, retArgTypesArray);
|
||||
#endif
|
||||
return diType;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user