[codegen][DI][inline] generation debug info for inlined functions. (#1251)

- We use DILexicalBlock and DILexicalBlockFile for generation debug info for kotlin inline (macro substituion by nature).
-- Note: DILexicalBlock aren't nested in opposite to inline function in C meaning.
- Changed DICompileUnit generation practise, now it generated for each file.
- added DI LLVM bindings.
This commit is contained in:
Vasily Levchenko
2018-02-01 20:43:21 +03:00
committed by GitHub
parent a818be1281
commit 0236868012
4 changed files with 160 additions and 84 deletions
+9 -3
View File
@@ -22,8 +22,6 @@
#include <llvm/IR/Instruction.h>
#include <llvm/Support/Casting.h>
#include "DebugInfoC.h"
/**
* c++ --std=c++11 llvmDebugInfoC/src/DebugInfoC.cpp -IllvmDebugInfoC/include/ -Idependencies/all/clang+llvm-3.9.0-darwin-macos/include -Ldependencies/all/clang+llvm-3.9.0-darwin-macos/lib -lLLVMCore -lLLVMSupport -lncurses -shared -o libLLVMDebugInfoC.dylib
*/
@@ -102,6 +100,15 @@ DISubprogramRef DICreateFunction(DIBuilderRef builder, DIScopeOpaqueRef scope,
scopeLine));
}
DIScopeOpaqueRef DICreateLexicalBlockFile(DIBuilderRef builderRef, DIScopeOpaqueRef scopeRef, DIFileRef fileRef) {
return llvm::wrap(llvm::unwrap(builderRef)->createLexicalBlockFile(llvm::unwrap(scopeRef), llvm::unwrap(fileRef)));
}
DIScopeOpaqueRef DICreateLexicalBlock(DIBuilderRef builderRef, DIScopeOpaqueRef scopeRef, DIFileRef fileRef, int line, int column) {
return llvm::wrap(llvm::unwrap(builderRef)->createLexicalBlock(llvm::unwrap(scopeRef), llvm::unwrap(fileRef), line, column));
}
DICompositeTypeRef DICreateStructType(DIBuilderRef refBuilder,
DIScopeOpaqueRef scope, const char *name,
DIFileRef file, unsigned lineNumber,
@@ -277,6 +284,5 @@ const char *DIGetSubprogramLinkName(DISubprogramRef sp) {
int DISubprogramDescribesFunction(DISubprogramRef sp, LLVMValueRef fn) {
return llvm::unwrap(sp)->describes(llvm::cast<llvm::Function>(llvm::unwrap(fn)));
}
} /* extern "C" */
+4 -1
View File
@@ -84,6 +84,10 @@ DIModuleRef DICreateModule(DIBuilderRef builder, DIScopeOpaqueRef scope,
const char* name, const char* configurationMacro,
const char* includePath, const char *iSysRoot);
DIScopeOpaqueRef DICreateLexicalBlockFile(DIBuilderRef builderRef, DIScopeOpaqueRef scopeRef, DIFileRef fileRef);
DIScopeOpaqueRef DICreateLexicalBlock(DIBuilderRef builderRef, DIScopeOpaqueRef scopeRef, DIFileRef fileRef, int line, int column);
DISubprogramRef DICreateFunction(DIBuilderRef builder, DIScopeOpaqueRef scope,
const char* name, const char *linkageName,
DIFileRef file, unsigned lineNo,
@@ -107,7 +111,6 @@ const char* LLVMBuilderGetCurrentBbName(LLVMBuilderRef builder);
const char *DIGetSubprogramLinkName(DISubprogramRef sp);
LLVMValueRef LLVMBuilderGetCurrentFunction(LLVMBuilderRef builder);
int DISubprogramDescribesFunction(DISubprogramRef sp, LLVMValueRef fn);
//void DIScopeDump(DIScopeOpaqueRef scope);
# ifdef __cplusplus
}
# endif