From: Devang Patel Date: Fri, 6 Nov 2009 17:58:12 +0000 (+0000) Subject: Do not bother to emit debug info for nameless global variable. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=84c73e9b8234287c4521e6d7e27c15e77843489e;p=oota-llvm.git Do not bother to emit debug info for nameless global variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86259 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index b64dbf433aa..7c1cc35ee9d 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -366,6 +366,9 @@ bool DIGlobalVariable::Verify() const { if (isNull()) return false; + if (!getDisplayName()) + return false; + if (getContext().isNull()) return false; diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 6b54e618c3d..de8cfc6b999 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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, diff --git a/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll b/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll new file mode 100644 index 00000000000..739def8051f --- /dev/null +++ b/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll @@ -0,0 +1,8 @@ +; RUN: llc %s -o /dev/null +@0 = internal constant i32 1 ; [#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 ]