[codegen][debug info] debug info generation do not touch llvm builder in the most cases.

This commit is contained in:
Vasily Levchenko
2018-01-12 14:19:49 +03:00
committed by Vasily Levchenko
parent e64c2f5990
commit 56d1881f18
4 changed files with 42 additions and 35 deletions
+12 -5
View File
@@ -241,15 +241,22 @@ void DIInsertDeclaration(DIBuilderRef builder, LLVMValueRef value, DILocalVariab
llvm::unwrap(bb));
}
DILocationRef LLVMBuilderSetDebugLocation(LLVMBuilderRef builder, unsigned line,
DILocationRef LLVMCreateLocation(LLVMContextRef contextRef, unsigned line,
unsigned col, DIScopeOpaqueRef scope) {
auto sp = llvm::unwrap(scope);
auto llvmBuilder = llvm::unwrap(builder);
auto location = llvm::DILocation::get(llvmBuilder->getContext(), line, col, sp, nullptr);
llvmBuilder->SetCurrentDebugLocation(location);
auto location = llvm::DILocation::get(*llvm::unwrap(contextRef), line, col, llvm::unwrap(scope), nullptr);
return llvm::wrap(location);
}
DILocationRef LLVMCreateLocationInlinedAt(LLVMContextRef contextRef, unsigned line,
unsigned col, DIScopeOpaqueRef scope, DILocationRef refLocationInlinedAt) {
auto location = llvm::DILocation::get(*llvm::unwrap(contextRef), line, col, llvm::unwrap(scope), llvm::unwrap(refLocationInlinedAt));
return llvm::wrap(location);
}
void LLVMBuilderSetDebugLocation(LLVMBuilderRef builder, DILocationRef refLocation) {
llvm::unwrap(builder)->SetCurrentDebugLocation(llvm::unwrap(refLocation));
}
void LLVMBuilderResetDebugLocation(LLVMBuilderRef builder) {
llvm::unwrap(builder)->SetCurrentDebugLocation(nullptr);
}
+3 -1
View File
@@ -99,7 +99,9 @@ DILocalVariableRef DICreateParameterVariable(DIBuilderRef builder, DIScopeOpaque
void DIInsertDeclaration(DIBuilderRef builder, LLVMValueRef value, DILocalVariableRef localVariable, DILocationRef location, LLVMBasicBlockRef bb, int64_t *expr, uint64_t exprCount);
DIExpressionRef DICreateEmptyExpression(DIBuilderRef builder);
void DIFunctionAddSubprogram(LLVMValueRef fn, DISubprogramRef sp);
DILocationRef LLVMBuilderSetDebugLocation(LLVMBuilderRef builder, unsigned line, unsigned col, DIScopeOpaqueRef scope);
DILocationRef LLVMCreateLocation(LLVMContextRef contextRef, unsigned line, unsigned col, DIScopeOpaqueRef scope);
DILocationRef LLVMCreateLocationInlinedAt(LLVMContextRef contextRef, unsigned line, unsigned col, DIScopeOpaqueRef scope, DILocationRef refLocation);
void LLVMBuilderSetDebugLocation(LLVMBuilderRef builder, DILocationRef refLocation);
void LLVMBuilderResetDebugLocation(LLVMBuilderRef builder);
const char* LLVMBuilderGetCurrentBbName(LLVMBuilderRef builder);
const char *DIGetSubprogramLinkName(DISubprogramRef sp);