Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,17 @@ void DwarfUnit::addType(DIE &Entity, const DIType *Ty,
addDIEEntry(Entity, Attribute, DIEEntry(*getOrCreateTypeDIE(Ty)));
}

// FIXME: change callsites to use the new DW_LNAME_ language codes.
llvm::dwarf::SourceLanguage DwarfUnit::getSourceLanguage() const {
return static_cast<llvm::dwarf::SourceLanguage>(
getLanguage().getUnversionedName());
const auto &Lang = getLanguage();

if (!Lang.hasVersionedName())
return static_cast<llvm::dwarf::SourceLanguage>(Lang.getName());

return llvm::dwarf::toDW_LANG(
static_cast<llvm::dwarf::SourceLanguageName>(Lang.getName()),
Lang.getVersion())
.value_or(llvm::dwarf::DW_LANG_hi_user);
}

std::string DwarfUnit::getParentContextString(const DIScope *Context) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ target triple = "arm64-apple-macosx"

@x = global i32 0, align 4, !dbg !0

; Function Attrs: mustprogress noinline nounwind optnone ssp uwtable(sync)
define void @_Z4funcv() !dbg !8 {
ret void, !dbg !11
}

!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!6, !7}

Expand All @@ -18,3 +23,7 @@ target triple = "arm64-apple-macosx"
!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!6 = !{i32 7, !"Dwarf Version", i32 5}
!7 = !{i32 2, !"Debug Info Version", i32 3}
!8 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", scope: !3, file: !3, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2)
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !DILocation(line: 2, column: 14, scope: !8)