void-packages/srcpkgs/ispc/patches/llvm12-001.patch

58 lines
3 KiB
Diff
Raw Normal View History

2021-05-17 15:55:01 +00:00
From 1c0f89dccb774f216c7f6e76a99ee907a1e641cb Mon Sep 17 00:00:00 2001
From: Dmitry Babokin <dmitry.y.babokin@intel.com>
Date: Tue, 22 Dec 2020 17:03:59 -0800
Subject: [PATCH] Fix to work with LLVM trunk after llvm/llvm-project@41c3b2713
---
src/ctx.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/ctx.cpp b/src/ctx.cpp
index 6fbb8b9cf..977e9d222 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -1473,11 +1473,15 @@ void FunctionEmitContext::AddDebugPos(llvm::Value *value, const SourcePos *pos,
llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(value);
if (inst != NULL && m->diBuilder) {
SourcePos p = pos ? *pos : currentPos;
- if (p.first_line != 0)
+ if (p.first_line != 0) {
// If first_line == 0, then we're in the middle of setting up
// the standard library or the like; don't add debug positions
// for those functions
- inst->setDebugLoc(llvm::DebugLoc::get(p.first_line, p.first_column, scope ? scope : GetDIScope()));
+ scope = scope ? scope : GetDIScope();
+ llvm::DebugLoc diLoc =
+ llvm::DILocation::get(scope->getContext(), p.first_line, p.first_column, scope, nullptr, false);
+ inst->setDebugLoc(diLoc);
+ }
}
}
@@ -1518,9 +1522,10 @@ void FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
llvm::DILocalVariable *var = m->diBuilder->createAutoVariable(
scope, sym->name, sym->pos.GetDIFile(), sym->pos.first_line, diType, true /* preserve through opts */);
+ llvm::DebugLoc diLoc =
+ llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
llvm::Instruction *declareInst =
- m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
- llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
+ m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
AddDebugPos(declareInst, &sym->pos, scope);
}
@@ -1535,9 +1540,10 @@ void FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum
m->diBuilder->createParameterVariable(scope, sym->name, argNum + 1, sym->pos.GetDIFile(), sym->pos.first_line,
diType, true /* preserve through opts */, flags);
+ llvm::DebugLoc diLoc =
+ llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
llvm::Instruction *declareInst =
- m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
- llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
+ m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
AddDebugPos(declareInst, &sym->pos, scope);
}