Do not bother to emit debug info for nameless global variable.

llvm-svn: 86259
This commit is contained in:
Devang Patel 2009-11-06 17:58:12 +00:00
parent 4daaf9d3f4
commit 0d1f6a9d0e
3 changed files with 13 additions and 2 deletions

View File

@ -366,6 +366,9 @@ bool DIGlobalVariable::Verify() const {
if (isNull())
return false;
if (!getDisplayName())
return false;
if (getContext().isNull())
return false;

View File

@ -1098,8 +1098,8 @@ DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
const DIGlobalVariable &GV) {
// If the global variable was optmized out then no need to create debug info entry.
if (!GV.getGlobal())
return NULL;
if (!GV.getGlobal()) return NULL;
if (!GV.getDisplayName()) return NULL;
DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string,

View File

@ -0,0 +1,8 @@
; RUN: llc %s -o /dev/null
@0 = internal constant i32 1 ; <i32*> [#uses=1]
!llvm.dbg.gv = !{!0}
!0 = metadata !{i32 458804, i32 0, metadata !1, metadata !"", metadata !"", metadata !"", metadata !1, i32 378, metadata !2, i1 true, i1 true, i32* @0}; [DW_TAG_variable ]
!1 = metadata !{i32 458769, i32 0, i32 1, metadata !"cbdsqr.f", metadata !"/home/duncan/LLVM/dragonegg/unsolved/", metadata !"4.5.0 20091030 (experimental)", i1 true, i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
!2 = metadata !{i32 458788, metadata !1, metadata !"integer(kind=4)", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]