Fix for debug information in trunk

This commit is contained in:
Vsevolod Livinskiy
2015-05-07 13:13:30 +03:00
committed by Anton Mitrokhin
parent f5c90dbd43
commit c9424a9989
9 changed files with 92 additions and 92 deletions

View File

@@ -922,10 +922,10 @@ lDefineConstantInt(const char *name, int val, llvm::Module *module,
llvm::DIType diType = sym->type->GetDIType(file);
Assert(diType.Verify());
#else // LLVM 3.7+
llvm::MDFile *file =
llvm::DIFile *file =
m->diBuilder->createFile(m->diCompileUnit->getFilename(),
m->diCompileUnit->getDirectory());
llvm::MDType *diType = sym->type->GetDIType(file);
llvm::DIType *diType = sym->type->GetDIType(file);
// Assert(diType.Verify());
#endif
// FIXME? DWARF says that this (and programIndex below) should
@@ -1024,10 +1024,10 @@ lDefineProgramIndex(llvm::Module *module, SymbolTable *symbolTable) {
llvm::DIType diType = sym->type->GetDIType(file);
Assert(diType.Verify());
#else // LLVM 3.7+
llvm::MDFile *file =
llvm::DIFile *file =
m->diBuilder->createFile(m->diCompileUnit->getFilename(),
m->diCompileUnit->getDirectory());
llvm::MDType *diType = sym->type->GetDIType(file);
llvm::DIType *diType = sym->type->GetDIType(file);
// Assert(diType.Verify());
#endif
#if defined(LLVM_3_6)// LLVM 3.6+

34
ctx.cpp
View File

@@ -349,13 +349,13 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
#elif defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIScope scope = llvm::DIScope(m->diCompileUnit);
#else // LLVM 3.7+
llvm::MDScope *scope = m->diCompileUnit;
llvm::DIScope *scope = m->diCompileUnit;
#endif
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType diSubprogramType;
AssertPos(currentPos, scope.Verify());
#else // LLVM 3.7+
llvm::MDType *diSubprogramType = NULL;
llvm::DIType *diSubprogramType = NULL;
#endif
const FunctionType *functionType = function->GetType();
@@ -378,10 +378,10 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
static_cast<llvm::DICompositeType>(diSubprogramType);
int flags = llvm::DIDescriptor::FlagPrototyped;
#else // LLVM 3.7+
Assert(llvm::isa<llvm::MDCompositeTypeBase>(diSubprogramType));
llvm::MDSubroutineType *diSubprogramType_n =
llvm::cast<llvm::MDSubroutineType>(getDICompositeType(diSubprogramType));
int flags = llvm::DebugNode::FlagPrototyped;
Assert(llvm::isa<llvm::DICompositeTypeBase>(diSubprogramType));
llvm::DISubroutineType *diSubprogramType_n =
llvm::cast<llvm::DISubroutineType>(getDICompositeType(diSubprogramType));
int flags = llvm::DINode::FlagPrototyped;
#endif
std::string mangledName = llvmFunction->getName();
@@ -1657,7 +1657,7 @@ FunctionEmitContext::AddDebugPos(llvm::Value *value, const SourcePos *pos,
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIScope *scope) {
#else // LLVM 3.7++
llvm::MDScope *scope) {
llvm::DIScope *scope) {
#endif
llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(value);
if (inst != NULL && m->diBuilder) {
@@ -1685,8 +1685,8 @@ FunctionEmitContext::StartScope() {
llvm::DIScope parentScope;
llvm::DILexicalBlock lexicalBlock;
#else // LLVM 3.7++
llvm::MDScope *parentScope;
llvm::MDLexicalBlock *lexicalBlock;
llvm::DIScope *parentScope;
llvm::DILexicalBlock *lexicalBlock;
#endif
if (debugScopes.size() > 0)
parentScope = debugScopes.back();
@@ -1710,7 +1710,7 @@ FunctionEmitContext::StartScope() {
AssertPos(currentPos, lexicalBlock.Verify());
debugScopes.push_back(lexicalBlock);
#else // LLVM 3.7+
debugScopes.push_back(llvm::cast<llvm::MDLexicalBlockBase>(lexicalBlock));
debugScopes.push_back(llvm::cast<llvm::DILexicalBlockBase>(lexicalBlock));
#endif
}
}
@@ -1728,7 +1728,7 @@ FunctionEmitContext::EndScope() {
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIScope
#else // LLVM 3.7+
llvm::MDScope*
llvm::DIScope*
#endif
FunctionEmitContext::GetDIScope() const {
AssertPos(currentPos, debugScopes.size() > 0);
@@ -1747,9 +1747,9 @@ FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
AssertPos(currentPos, diType.Verify());
llvm::DIVariable var =
#else // LLVM 3.7+
llvm::MDScope *scope = GetDIScope();
llvm::MDType *diType = sym->type->GetDIType(scope);
llvm::MDLocalVariable *var =
llvm::DIScope *scope = GetDIScope();
llvm::DIType *diType = sym->type->GetDIType(scope);
llvm::DILocalVariable *var =
#endif
m->diBuilder->createLocalVariable(llvm::dwarf::DW_TAG_auto_variable,
scope,
@@ -1791,9 +1791,9 @@ FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum) {
AssertPos(currentPos, diType.Verify());
llvm::DIVariable var =
#else // LLVM 3.7+
llvm::MDScope *scope = diSubprogram;
llvm::MDType *diType = sym->type->GetDIType(scope);
llvm::MDLocalVariable *var =
llvm::DIScope *scope = diSubprogram;
llvm::DIType *diType = sym->type->GetDIType(scope);
llvm::DILocalVariable *var =
#endif
m->diBuilder->createLocalVariable(llvm::dwarf::DW_TAG_arg_variable,
scope,

14
ctx.h
View File

@@ -355,7 +355,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIScope *scope = NULL);
#else // LLVM 3.7++
llvm::MDScope *scope = NULL);
llvm::DIScope *scope = NULL);
#endif
/** Inform the debugging information generation code that a new scope
@@ -371,7 +371,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIScope GetDIScope() const;
#else // LLVM 3.7++
llvm::MDScope *GetDIScope() const;
llvm::DIScope *GetDIScope() const;
#endif
/** Emits debugging information for the variable represented by
@@ -696,17 +696,17 @@ private:
function. */
std::vector<llvm::DILexicalBlock> debugScopes;
#else // LLVM 3.7++
/** MDFile object corresponding to the source file where the current
/** DIFile object corresponding to the source file where the current
function was defined (used for debugging info). */
llvm::MDFile *diFile;
llvm::DIFile *diFile;
/** MDSubprogram corresponding to this function (used for debugging
/** DISubprogram corresponding to this function (used for debugging
info). */
llvm::MDSubprogram *diSubprogram;
llvm::DISubprogram *diSubprogram;
/** These correspond to the current set of nested scopes in the
function. */
std::vector<llvm::MDScope *> debugScopes;
std::vector<llvm::DIScope *> debugScopes;
#endif
/** True if a 'launch' statement has been encountered in the function. */

View File

@@ -1432,7 +1432,7 @@ SourcePos::SourcePos(const char *n, int fl, int fc, int ll, int lc) {
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIFile
#else // LLVM 3.7+
llvm::MDFile*
llvm::DIFile*
#endif
SourcePos::GetDIFile() const {
std::string directory, filename;
@@ -1441,7 +1441,7 @@ SourcePos::GetDIFile() const {
llvm::DIFile ret = m->diBuilder->createFile(filename, directory);
Assert(ret.Verify());
#else // LLVM 3.7+
llvm::MDFile *ret = m->diBuilder->createFile(filename, directory);
llvm::DIFile *ret = m->diBuilder->createFile(filename, directory);
#endif
return ret;
}

10
ispc.h
View File

@@ -91,9 +91,9 @@ namespace llvm {
class DIType;
class DIDescriptor;
#else // LLVM 3.7++
class MDFile;
class MDType;
class MDScope;
class DIFile;
class DIType;
class DIScope;
#endif
}
@@ -148,8 +148,8 @@ struct SourcePos {
/** Returns a LLVM DIFile object that represents the SourcePos's file */
llvm::DIFile GetDIFile() const;
#else
/** Returns a LLVM MDFile object that represents the SourcePos's file */
llvm::MDFile *GetDIFile() const;
/** Returns a LLVM DIFile object that represents the SourcePos's file */
llvm::DIFile *GetDIFile() const;
#endif
bool operator==(const SourcePos &p2) const;

View File

@@ -207,20 +207,20 @@ lStripUnusedDebugInfo(llvm::Module *module) {
}
if (scope.isSubprogram()) {
#else // LLVM 3.7+
llvm::MDLocation *dloc = llvm::cast<llvm::MDLocation>(node);
llvm::MDScope *scope = dloc->getScope();
llvm::DILocation *dloc = llvm::cast<llvm::DILocation>(node);
llvm::DIScope *scope = dloc->getScope();
node = dloc->getInlinedAt();
// now following a chain of nested scopes
while (!0) {
if (llvm::isa<llvm::MDLexicalBlockFile>(scope))
scope = llvm::cast<llvm::MDLexicalBlockFile>(scope)->getScope();
else if (llvm::isa<llvm::MDLexicalBlockBase>(scope))
scope = llvm::cast<llvm::MDLexicalBlockBase>(scope)->getScope();
else if (llvm::isa<llvm::MDNamespace>(scope))
scope = llvm::cast<llvm::MDNamespace>(scope)->getScope();
if (llvm::isa<llvm::DILexicalBlockFile>(scope))
scope = llvm::cast<llvm::DILexicalBlockFile>(scope)->getScope();
else if (llvm::isa<llvm::DILexicalBlockBase>(scope))
scope = llvm::cast<llvm::DILexicalBlockBase>(scope)->getScope();
else if (llvm::isa<llvm::DINamespace>(scope))
scope = llvm::cast<llvm::DINamespace>(scope)->getScope();
else break;
}
if (llvm::isa<llvm::MDSubprogram>(scope)) {
if (llvm::isa<llvm::DISubprogram>(scope)) {
#endif
// good, the chain ended with a function; adding
SPall.insert(scope);
@@ -237,8 +237,8 @@ lStripUnusedDebugInfo(llvm::Module *module) {
llvm::DIArray subprograms = cu.getSubprograms();
if (subprograms.getNumElements() == 0) {
#else // LLVM 3.7+
llvm::MDCompileUnit *cu = llvm::cast<llvm::MDCompileUnit>(cuNode);
llvm::MDSubprogramArray subprograms = cu->getSubprograms();
llvm::DICompileUnit *cu = llvm::cast<llvm::DICompileUnit>(cuNode);
llvm::DISubprogramArray subprograms = cu->getSubprograms();
if (subprograms.size() == 0) {
#endif
continue;
@@ -341,7 +341,7 @@ lStripUnusedDebugInfo(llvm::Module *module) {
llvm::ArrayRef<llvm::Metadata *>(usedSubprograms));
cu.replaceSubprograms(llvm::DIArray(replNode));
#else // LLVM 3.7+
llvm::MDSubprogramArray nodeSPs = cu->getSubprograms();
llvm::DISubprogramArray nodeSPs = cu->getSubprograms();
Assert(nodeSPs.size() == subprograms.size());
for (int i = 0; i < (int)nodeSPs.size(); ++i)
Assert(nodeSPs [i] == subprograms [i]);
@@ -721,7 +721,7 @@ Module::AddGlobalVariable(const std::string &name, const Type *type, Expr *initE
(sym->storageClass == SC_STATIC),
sym_const_storagePtr);
#else // LLVM 3.7+
llvm::MDFile *file = pos.GetDIFile();
llvm::DIFile *file = pos.GetDIFile();
llvm::Constant *sym_const_storagePtr = llvm::dyn_cast<llvm::Constant>(sym->storagePtr);
Assert(sym_const_storagePtr);
diBuilder->createGlobalVariable(

View File

@@ -164,7 +164,7 @@ public:
#if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DICompileUnit diCompileUnit;
#elif !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.7++
llvm::MDCompileUnit *diCompileUnit;
llvm::DICompileUnit *diCompileUnit;
#endif // LLVM_3_4+
private:

View File

@@ -82,7 +82,7 @@ lShouldPrintName(const std::string &name) {
#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) {
static llvm::DIType *lCreateDIArray(llvm::DIType *eltType, int count) {
#endif
#ifdef LLVM_3_2
int lowerBound = 0, upperBound = count-1;
@@ -111,7 +111,7 @@ static llvm::MDType *lCreateDIArray(llvm::MDType *eltType, int count) {
uint64_t size = eltType.getSizeInBits() * count;
uint64_t align = eltType.getAlignInBits();
#else // LLVM 3.7++
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(subs);
llvm::DINodeArray subArray = m->diBuilder->getOrCreateArray(subs);
uint64_t size = eltType->getSizeInBits() * count;
uint64_t align = eltType->getAlignInBits();
#endif
@@ -528,7 +528,7 @@ AtomicType::LLVMType(llvm::LLVMContext *ctx) 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 {
llvm::DIType *AtomicType::GetDIType(llvm::DIScope *scope) const {
#endif
Assert(variability.type != Variability::Unbound);
@@ -607,8 +607,8 @@ llvm::MDType *AtomicType::GetDIType(llvm::MDScope *scope) const {
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);
llvm::DINodeArray 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();
#endif
@@ -847,7 +847,7 @@ EnumType::LLVMType(llvm::LLVMContext *ctx) 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 {
llvm::DIType *EnumType::GetDIType(llvm::DIScope *scope) const {
#endif
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5)
@@ -878,10 +878,10 @@ llvm::MDType *EnumType::GetDIType(llvm::MDScope *scope) const {
32 /* align in bits */,
elementArray, llvm::DIType());
#else // LLVM 3.7++
llvm::DebugNodeArray elementArray =
llvm::DINodeArray elementArray =
m->diBuilder->getOrCreateArray(enumeratorDescriptors);
llvm::MDFile *diFile = pos.GetDIFile();
llvm::MDType *diType =
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 */,
@@ -903,7 +903,7 @@ llvm::MDType *EnumType::GetDIType(llvm::MDScope *scope) const {
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);
llvm::DINodeArray subArray = m->diBuilder->getOrCreateArray(sub);
uint64_t size = diType->getSizeInBits() * g->target->getVectorWidth();
uint64_t align = diType->getAlignInBits()* g->target->getVectorWidth();
#endif
@@ -1260,12 +1260,12 @@ llvm::DIType PointerType::GetDIType(llvm::DIDescriptor scope) const {
}
llvm::DIType diTargetType = baseType->GetDIType(scope);
#else //LLVM 3.7++
llvm::MDType *PointerType::GetDIType(llvm::MDScope *scope) const {
llvm::DIType *PointerType::GetDIType(llvm::DIScope *scope) const {
if (baseType == NULL) {
Assert(m->errorCount > 0);
return NULL;
}
llvm::MDType *diTargetType = baseType->GetDIType(scope);
llvm::DIType *diTargetType = baseType->GetDIType(scope);
#endif
int bitsSize = g->target->is32Bit() ? 32 : 64;
int ptrAlignBits = bitsSize;
@@ -1278,7 +1278,7 @@ llvm::MDType *PointerType::GetDIType(llvm::MDScope *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 eltType =
#else //LLVM 3.7++
llvm::MDDerivedType *eltType =
llvm::DIDerivedType *eltType =
#endif
m->diBuilder->createPointerType(diTargetType, bitsSize, ptrAlignBits);
return lCreateDIArray(eltType, g->target->getVectorWidth());
@@ -1575,12 +1575,12 @@ llvm::DIType ArrayType::GetDIType(llvm::DIDescriptor scope) const {
}
llvm::DIType eltType = child->GetDIType(scope);
#else //LLVM 3.7++
llvm::MDType *ArrayType::GetDIType(llvm::MDScope *scope) const {
llvm::DIType *ArrayType::GetDIType(llvm::DIScope *scope) const {
if (child == NULL) {
Assert(m->errorCount > 0);
return NULL;
}
llvm::MDType *eltType = child->GetDIType(scope);
llvm::DIType *eltType = child->GetDIType(scope);
#endif
return lCreateDIArray(eltType, numElements);
}
@@ -1820,8 +1820,8 @@ VectorType::LLVMType(llvm::LLVMContext *ctx) const {
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);
llvm::DIType *VectorType::GetDIType(llvm::DIScope *scope) const {
llvm::DIType *eltType = base->GetDIType(scope);
#endif
#ifdef LLVM_3_2
llvm::Value *sub = m->diBuilder->getOrCreateSubrange(0, numElements-1);
@@ -1839,7 +1839,7 @@ llvm::MDType *VectorType::GetDIType(llvm::MDScope *scope) const {
uint64_t sizeBits = eltType.getSizeInBits() * numElements;
uint64_t align = eltType.getAlignInBits();
#else // LLVM 3.7++
llvm::DebugNodeArray subArray = m->diBuilder->getOrCreateArray(sub);
llvm::DINodeArray subArray = m->diBuilder->getOrCreateArray(sub);
uint64_t sizeBits = eltType->getSizeInBits() * numElements;
uint64_t align = eltType->getAlignInBits();
#endif
@@ -2262,7 +2262,7 @@ StructType::LLVMType(llvm::LLVMContext *ctx) 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 {
llvm::DIType *StructType::GetDIType(llvm::DIScope *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)
@@ -2279,7 +2279,7 @@ llvm::MDType *StructType::GetDIType(llvm::MDScope *scope) const {
uint64_t eltAlign = eltType.getAlignInBits();
uint64_t eltSize = eltType.getSizeInBits();
#else // LLVM 3.7++
llvm::MDType *eltType = GetElementType(i)->GetDIType(scope);
llvm::DIType *eltType = GetElementType(i)->GetDIType(scope);
uint64_t eltAlign = eltType->getAlignInBits();
uint64_t eltSize = eltType->getSizeInBits();
#endif
@@ -2300,8 +2300,8 @@ llvm::MDType *StructType::GetDIType(llvm::MDScope *scope) const {
llvm::DIFile diFile = elementPositions[i].GetDIFile();
llvm::DIType fieldType =
#else // LLVM 3.7++
llvm::MDFile *diFile = elementPositions[i].GetDIFile();
llvm::MDDerivedType *fieldType =
llvm::DIFile *diFile = elementPositions[i].GetDIFile();
llvm::DIDerivedType *fieldType =
#endif
m->diBuilder->createMemberType(scope, elementNames[i], diFile,
line, eltSize, eltAlign,
@@ -2320,8 +2320,8 @@ llvm::MDType *StructType::GetDIType(llvm::MDScope *scope) const {
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();
llvm::DINodeArray elements = m->diBuilder->getOrCreateArray(elementLLVMTypes);
llvm::DIFile *diFile = pos.GetDIFile();
#endif
return m->diBuilder->createStructType(
diFile,
@@ -2569,9 +2569,9 @@ 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;
llvm::DIType *UndefinedStructType::GetDIType(llvm::DIScope *scope) const {
llvm::DIFile *diFile = pos.GetDIFile();
llvm::DINodeArray elements;
#endif
return m->diBuilder->createStructType(
diFile,
@@ -2846,12 +2846,12 @@ llvm::DIType ReferenceType::GetDIType(llvm::DIDescriptor scope) const {
}
llvm::DIType diTargetType = targetType->GetDIType(scope);
#else //LLVM 3.7++
llvm::MDType *ReferenceType::GetDIType(llvm::MDScope *scope) const {
llvm::DIType *ReferenceType::GetDIType(llvm::DIScope *scope) const {
if (targetType == NULL) {
Assert(m->errorCount > 0);
return NULL;
}
llvm::MDType *diTargetType = targetType->GetDIType(scope);
llvm::DIType *diTargetType = targetType->GetDIType(scope);
#endif
return m->diBuilder->createReferenceType(llvm::dwarf::DW_TAG_reference_type,
diTargetType);
@@ -3120,7 +3120,7 @@ FunctionType::LLVMType(llvm::LLVMContext *ctx) 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 {
llvm::DIType *FunctionType::GetDIType(llvm::DIScope *scope) const {
#endif
#if defined (LLVM_3_2) || defined (LLVM_3_3) || defined (LLVM_3_4) || defined (LLVM_3_5)
@@ -3155,9 +3155,9 @@ llvm::MDType *FunctionType::GetDIType(llvm::MDScope *scope) const {
// FIXME: DIFile
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);
#else // LLVM 3.7++
llvm::MDTypeRefArray retArgTypesArray =
llvm::DITypeRefArray retArgTypesArray =
m->diBuilder->getOrCreateTypeArray(retArgTypes);
llvm::MDType *diType =
llvm::DIType *diType =
m->diBuilder->createSubroutineType(NULL, retArgTypesArray);
#endif
return diType;

22
type.h
View File

@@ -227,9 +227,9 @@ public:
corresponding to this type. */
virtual llvm::DIType GetDIType(llvm::DIDescriptor scope) const = 0;
#else
/** Returns the MDType (LLVM's debugging information structure),
/** Returns the DIType (LLVM's debugging information structure),
corresponding to this type. */
virtual llvm::MDType *GetDIType(llvm::MDScope *scope) const = 0;
virtual llvm::DIType *GetDIType(llvm::DIScope *scope) const = 0;
#endif
/** Checks two types for equality. Returns true if they are exactly
@@ -320,7 +320,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
/** This enumerator records the basic types that AtomicTypes can be
@@ -403,7 +403,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
/** Provides the enumerators defined in the enum definition. */
@@ -488,7 +488,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
static PointerType *Void;
@@ -594,7 +594,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
@@ -666,7 +666,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
int GetElementCount() const;
@@ -721,7 +721,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
/** Returns the type of the structure element with the given name (if any).
@@ -813,7 +813,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
/** Returns the name of the structure type. (e.g. struct Foo -> "Foo".) */
@@ -860,7 +860,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
private:
@@ -918,7 +918,7 @@ public:
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
#else // LLVM 3.7++
llvm::MDType *GetDIType(llvm::MDScope *scope) const;
llvm::DIType *GetDIType(llvm::DIScope *scope) const;
#endif
const Type *GetReturnType() const { return returnType; }