Skip to content

Commit

Permalink
Fix ISPC buildfail after LLVM API change in r243764
Browse files Browse the repository at this point in the history
  • Loading branch information
ncos committed Aug 2, 2015
1 parent ab0e8bb commit f354803
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ctx.cpp
Expand Up @@ -1773,13 +1773,25 @@ FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
//llvm::MDType *diType = sym->type->GetDIType(scope);
//llvm::MDLocalVariable *var =
#endif

#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7*/
m->diBuilder->createLocalVariable(llvm::dwarf::DW_TAG_auto_variable,
scope,
sym->name,
sym->pos.GetDIFile(),
sym->pos.first_line,
diType,
true /* preserve through opts */);
#else /* LLVM 3.8+ */
m->diBuilder->createAutoVariable(scope,
sym->name,
sym->pos.GetDIFile(),
sym->pos.first_line,
diType,
true /* preserve through opts */);
#endif


#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6 /* 3.2, 3.3, 3.4, 3.5, 3.6 */
AssertPos(currentPos, var.Verify());
llvm::Instruction *declareInst =
Expand Down Expand Up @@ -1820,6 +1832,8 @@ FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum) {
//llvm::MDType *diType = sym->type->GetDIType(scope);
//llvm::MDLocalVariable *var =
#endif

#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
m->diBuilder->createLocalVariable(llvm::dwarf::DW_TAG_arg_variable,
scope,
sym->name,
Expand All @@ -1829,6 +1843,17 @@ FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum) {
true /* preserve through opts */,
flags,
argNum + 1);
#else /* LLVM 3.8+ */
m->diBuilder->createParameterVariable(scope,
sym->name,
argNum + 1,
sym->pos.GetDIFile(),
sym->pos.first_line,
diType,
true /* preserve through opts */,
flags);
#endif

#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6 /* 3.2, 3.3, 3.4, 3.5, 3.6 */
AssertPos(currentPos, var.Verify());
llvm::Instruction *declareInst =
Expand Down

0 comments on commit f354803

Please sign in to comment.