diff --git a/gen/functions.cpp b/gen/functions.cpp index 82bb67e7..97d4d774 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -57,7 +57,11 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype, else { Type* rt = f->next; +#if LDC_LLVM_VER == 300 unsigned a = 0; +#else + llvm::Attributes a = None; +#endif // sret return if (abi->returnInArg(f)) { @@ -73,8 +77,13 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype, if (f->isref) t = t->pointerTo(); #endif +#if LDC_LLVM_VER == 300 if (unsigned se = DtoShouldExtend(t)) a = se; +#else + if (llvm::Attributes atts = DtoShouldExtend(t)) + a = atts; +#endif } #if DMDV2 fty.ret = new IrFuncTyArg(rt, f->isref, a); @@ -148,7 +157,11 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype, #endif Type* argtype = arg->type; +#if LDC_LLVM_VER == 300 unsigned a = 0; +#else + llvm::Attributes a = None; +#endif // handle lazy args if (arg->storageClass & STClazy) @@ -411,7 +424,11 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati // set attrs on the rest of the arguments size_t n = Parameter::dim(f->parameters); - LLSmallVector attrptr(n, 0); +#if LDC_LLVM_VER == 300 + LLSmallVector attrptr(n, 0); +#else + LLSmallVector attrptr(n, None); +#endif for (size_t k = 0; k < n; ++k) { diff --git a/gen/tocall.cpp b/gen/tocall.cpp index 6738b0e1..79f12fc8 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -277,7 +277,11 @@ void DtoBuildDVarArgList(std::vector& args, llvm::AttributeWithIndex Attr; // specify arguments args.push_back(DtoLoad(typeinfoarrayparam)); +#if LDC_LLVM_VER == 300 if (unsigned atts = tf->fty.arg_arguments->attrs) { +#else + if (llvm::Attributes atts = tf->fty.arg_arguments->attrs) { +#endif Attr.Index = argidx; Attr.Attrs = atts; attrs.push_back(Attr); @@ -285,7 +289,11 @@ void DtoBuildDVarArgList(std::vector& args, ++argidx; args.push_back(gIR->ir->CreateBitCast(mem, getPtrToType(LLType::getInt8Ty(gIR->context())), "tmp")); +#if LDC_LLVM_VER == 300 if (unsigned atts = tf->fty.arg_argptr->attrs) { +#else + if (llvm::Attributes atts = tf->fty.arg_argptr->attrs) { +#endif Attr.Index = argidx; Attr.Attrs = atts; attrs.push_back(Attr); @@ -498,7 +506,11 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* size_t n = Parameter::dim(tf->parameters); +#if LDC_LLVM_VER == 300 LLSmallVector attrptr(n, 0); +#else + LLSmallVector attrptr(n, llvm::Attribute::None); +#endif std::vector argvals; if (dfnval && dfnval->func->isArrayOp) { diff --git a/gen/todebug.cpp b/gen/todebug.cpp index efb41155..3f8618ca 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -2,7 +2,11 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/FileSystem.h" +#if LDC_LLVM_VER == 300 #include "llvm/Support/PathV2.h" +#else +#include "llvm/Support/Path.h" +#endif #include "declaration.h" #include "module.h" @@ -480,6 +484,9 @@ llvm::DISubprogram DtoDwarfSubProgram(FuncDeclaration* fd) dwarfTypeDescription(retType, NULL), // type fd->protection == PROTprivate, // is local to unit gIR->dmodule == getDefinedModule(fd), // isdefinition +#if LDC_LLVM_VER >= 301 + fd->loc.linnum, // FIXME: scope line +#endif 0, // Flags false, // isOptimized fd->ir.irFunc->func @@ -508,6 +515,9 @@ llvm::DISubprogram DtoDwarfSubProgramInternal(const char* prettyname, const char llvm::DIType(NULL), // return type. TODO: fill it up true, // is local to unit true // isdefinition +#if LDC_LLVM_VER >= 301 + , 0 // FIXME: scope line +#endif ); }