DEBUGINFO: generate forward declaraion of the type instead of kotlin.Any

Previously in case type wasn't resolved in codegen (debug info wasn't constructed from IR),
we'd use reference to kotlin.Any? as type, from now we're using forward declaration. What next?
- type parameters... how to deal with?

(cherry picked from commit 579acba659fe52afec638fc00e07a320560bd5fa)
This commit is contained in:
Vasily Levchenko
2017-05-18 13:56:10 +03:00
committed by vvlevchenko
parent c9d7f976a5
commit c8badb0a38
2 changed files with 43 additions and 2 deletions
+8 -1
View File
@@ -48,6 +48,10 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DIExpression, DIExpressionRef)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef)
}
/**
* see [DIFlags::FlagFwdDecl].
*/
#define DI_FORWARD_DECLARAION (4)
extern "C" {
DIBuilderRef DICreateBuilder(LLVMModuleRef module) {
@@ -106,8 +110,11 @@ DICompositeTypeRef DICreateStructType(DIBuilderRef refBuilder,
uint64_t elementsCount,
DICompositeTypeRef refPlace) {
auto builder = llvm::unwrap(refBuilder);
if ((flags & DI_FORWARD_DECLARAION) != 0) {
return llvm::wrap(builder->createStructType(llvm::unwrap(scope), name, NULL, 0, 0, 0, flags, NULL, NULL));
}
std::vector<llvm::Metadata *> typeElements;
for(int i = 0; i != elementsCount; ++i) {
for(int i = 0; i < elementsCount; ++i) {
typeElements.push_back(llvm::unwrap(elements[i]));
}
auto elementsArray = builder->getOrCreateArray(typeElements);