From 2e3af7f474aa30cc97942b28c77f908096c0ee86 Mon Sep 17 00:00:00 2001 From: Anton Mitrokhin Date: Wed, 19 Nov 2014 13:24:46 +0300 Subject: [PATCH] fixed ISPC compilation fail caused by the change of llvm::Value to llvm::Constant in DIBuilder member functions (LLVM commit 222070) --- builtins.cpp | 23 +++++++++++++++-------- module.cpp | 11 +++++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/builtins.cpp b/builtins.cpp index 8686ec97..aa7b86d0 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -921,18 +921,22 @@ lDefineConstantInt(const char *name, int val, llvm::Module *module, // FIXME? DWARF says that this (and programIndex below) should // have the DW_AT_artifical attribute. It's not clear if this // matters for anything though. - llvm::DIGlobalVariable var = + #if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5)// LLVM 3.6+ - m->diBuilder->createGlobalVariable(file, + llvm::Constant *sym_const_storagePtr = llvm::dyn_cast(sym->storagePtr); + Assert(sym_const_storagePtr); + llvm::DIGlobalVariable var = m->diBuilder->createGlobalVariable( + file, name, name, file, 0 /* line */, diType, true /* static */, - sym->storagePtr); + sym_const_storagePtr); #else - m->diBuilder->createGlobalVariable(name, + llvm::DIGlobalVariable var = m->diBuilder->createGlobalVariable( + name, file, 0 /* line */, diType, @@ -992,18 +996,21 @@ lDefineProgramIndex(llvm::Module *module, SymbolTable *symbolTable) { llvm::DIFile file; llvm::DIType diType = sym->type->GetDIType(file); Assert(diType.Verify()); - llvm::DIGlobalVariable var = #if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5)// LLVM 3.6+ - m->diBuilder->createGlobalVariable(file, + llvm::Constant *sym_const_storagePtr = llvm::dyn_cast(sym->storagePtr); + Assert(sym_const_storagePtr); + llvm::DIGlobalVariable var = m->diBuilder->createGlobalVariable( + file, sym->name.c_str(), sym->name.c_str(), file, 0 /* line */, diType, false /* static */, - sym->storagePtr); + sym_const_storagePtr); #else - m->diBuilder->createGlobalVariable(sym->name.c_str(), + llvm::DIGlobalVariable var = m->diBuilder->createGlobalVariable( + sym->name.c_str(), file, 0 /* line */, diType, diff --git a/module.cpp b/module.cpp index 1e71cb8c..4102b31e 100644 --- a/module.cpp +++ b/module.cpp @@ -607,18 +607,21 @@ Module::AddGlobalVariable(const std::string &name, const Type *type, Expr *initE if (diBuilder) { llvm::DIFile file = pos.GetDIFile(); - llvm::DIGlobalVariable var = #if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5)// LLVM 3.6+ - diBuilder->createGlobalVariable(file, + llvm::Constant *sym_const_storagePtr = llvm::dyn_cast(sym->storagePtr); + Assert(sym_const_storagePtr); + llvm::DIGlobalVariable var = diBuilder->createGlobalVariable( + file, name, name, file, pos.first_line, sym->type->GetDIType(file), (sym->storageClass == SC_STATIC), - sym->storagePtr); + sym_const_storagePtr); #else - diBuilder->createGlobalVariable(name, + llvm::DIGlobalVariable var = diBuilder->createGlobalVariable( + name, file, pos.first_line, sym->type->GetDIType(file),