diff --git a/ctx.cpp b/ctx.cpp index b7691f15..ee3786fe 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -344,6 +344,14 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, AssertPos(currentPos, diSubprogramType.Verify()); } +#if defined(LLVM_3_4) + Assert(diSubprogramType.isCompositeType()); + llvm::DICompositeType diSubprogramType_n = + static_cast(diSubprogramType); +#else + llvm::DIType diSubprogramType_n = diSubprogramType; +#endif + std::string mangledName = llvmFunction->getName(); if (mangledName == funSym->name) mangledName = ""; @@ -356,7 +364,7 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, diSubprogram = m->diBuilder->createFunction(diFile /* scope */, funSym->name, mangledName, diFile, - firstLine, diSubprogramType, + firstLine, diSubprogramType_n, isStatic, true, /* is defn */ firstLine, flags, diff --git a/type.cpp b/type.cpp index f90cd6e5..2875eaec 100644 --- a/type.cpp +++ b/type.cpp @@ -2879,7 +2879,11 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const { for (int i = 0; i < GetNumParameters(); ++i) { const Type *t = GetParameterType(i); if (t == NULL) +#if defined(LLVM_3_4) + return llvm::DICompositeType(); +#else return llvm::DIType(); +#endif retArgTypes.push_back(t->GetDIType(scope)); }