[llvm] r196130 - DebugInfo: Type Units: Propagate the correct DW_AT_language into type units.
David Blaikie
dblaikie at gmail.com
Mon Dec 2 10:44:30 PST 2013
Author: dblaikie
Date: Mon Dec 2 12:44:29 2013
New Revision: 196130
URL: http://llvm.org/viewvc/llvm-project?rev=196130&view=rev
Log:
DebugInfo: Type Units: Propagate the correct DW_AT_language into type units.
Added:
llvm/trunk/test/DebugInfo/X86/c-type-units.ll
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=196130&r1=196129&r2=196130&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Dec 2 12:44:29 2013
@@ -989,7 +989,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(con
else if (Ty.isCompositeType()) {
DICompositeType CTy(Ty);
if (shouldCreateTypeUnit(CTy, DD)) {
- DD->addTypeUnitType(TyDIE, CTy);
+ DD->addTypeUnitType(getLanguage(), TyDIE, CTy);
// Skip updating the accellerator tables since this is not the full type
return TyDIE;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196130&r1=196129&r2=196130&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Dec 2 12:44:29 2013
@@ -3055,7 +3055,8 @@ void DwarfDebug::emitDebugStrDWO() {
OffSec, StrSym);
}
-void DwarfDebug::addTypeUnitType(DIE *RefDie, DICompositeType CTy) {
+void DwarfDebug::addTypeUnitType(uint16_t Language, DIE *RefDie,
+ DICompositeType CTy) {
DenseMap<const MDNode *,
std::pair<uint64_t, SmallVectorImpl<DIE *> *> >::iterator I =
TypeUnits.find(CTy);
@@ -3068,12 +3069,11 @@ void DwarfDebug::addTypeUnitType(DIE *Re
}
} else {
DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit);
- CompileUnit *NewCU =
- new CompileUnit(GlobalCUIndexCount++, UnitDie,
- dwarf::DW_LANG_C_plus_plus, Asm, this, &InfoHolder);
+ CompileUnit *NewCU = new CompileUnit(GlobalCUIndexCount++, UnitDie,
+ Language, Asm, this, &InfoHolder);
CUDieMap.insert(std::make_pair(UnitDie, NewCU));
NewCU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
- dwarf::DW_LANG_C_plus_plus);
+ Language);
// Register the type in the TypeUnits map with a vector of references to be
// populated whenever a reference is required.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=196130&r1=196129&r2=196130&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Dec 2 12:44:29 2013
@@ -704,7 +704,7 @@ public:
/// \brief Add a DIE to the set of types that we're going to pull into
/// type units.
- void addTypeUnitType(DIE *Die, DICompositeType CTy);
+ void addTypeUnitType(uint16_t Language, DIE *Die, DICompositeType CTy);
/// \brief Add a label so that arange data can be generated for it.
void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
Added: llvm/trunk/test/DebugInfo/X86/c-type-units.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/c-type-units.ll?rev=196130&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/c-type-units.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/c-type-units.ll Mon Dec 2 12:44:29 2013
@@ -0,0 +1,28 @@
+; REQUIRES: object-emission
+
+; RUN: llc -o - %s -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+
+; struct foo {
+; } f;
+
+; CHECK: DW_TAG_type_unit
+; CHECK-NEXT: DW_AT_language [DW_FORM_data2] (0x000c)
+
+%struct.foo = type {}
+
+ at f = common global %struct.foo zeroinitializer, align 1
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!7, !8}
+!llvm.ident = !{!9}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.5 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !2, metadata !3, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/simple.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"simple.c", metadata !"/tmp/dbginfo"}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786484, i32 0, null, metadata !"f", metadata !"f", metadata !"", metadata !5, i32 2, metadata !6, i32 0, i32 1, %struct.foo* @f, null} ; [ DW_TAG_variable ] [f] [line 2] [def]
+!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/simple.c]
+!6 = metadata !{i32 786451, metadata !1, null, metadata !"foo", i32 1, i64 0, i64 8, i32 0, i32 0, null, metadata !2, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [foo] [line 1, size 0, align 8, offset 0] [def] [from ]
+!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!8 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
+!9 = metadata !{metadata !"clang version 3.5 "}
More information about the llvm-commits
mailing list