diff --git a/codon/sir/llvm/llvisitor.cpp b/codon/sir/llvm/llvisitor.cpp index 37ac5380..cd0cf2ee 100644 --- a/codon/sir/llvm/llvisitor.cpp +++ b/codon/sir/llvm/llvisitor.cpp @@ -700,9 +700,13 @@ llvm::DISubprogram *LLVMVisitor::getDISubprogramForFunc(const Func *x) { auto *derivedType = llvm::cast(getDIType(x->getType())); auto *subroutineType = llvm::cast(derivedType->getRawBaseType()); + + std::string baseName = x->getUnmangledName(); + if (auto *parent = x->getParentType()) + baseName = parent->getName() + "." + baseName; llvm::DISubprogram *subprogram = db.builder->createFunction( - file, x->getUnmangledName(), getNameForFunction(x), file, srcInfo->line, - subroutineType, /*ScopeLine=*/0, llvm::DINode::FlagZero, + file, baseName, getNameForFunction(x), file, srcInfo->line, subroutineType, + /*ScopeLine=*/0, llvm::DINode::FlagZero, llvm::DISubprogram::toSPFlags(/*IsLocalToUnit=*/true, /*IsDefinition=*/true, /*IsOptimized=*/!db.debug)); return subprogram;