diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -227,10 +227,6 @@ if (Global && Global->hasDLLImportStorageClass()) continue; - // Nothing to describe without address or constant. - if (!Global && (!Expr || !Expr->isConstant())) - continue; - if (Global && Global->isThreadLocal() && !Asm->getObjFileLowering().supportDebugThreadLocalLocation()) continue; diff --git a/llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test b/llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test new file mode 100644 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test @@ -0,0 +1,10 @@ +RUN: echo 'namespace N { int varname; } extern "C" void _start(){}' | clang++ -Wall -Werror -gdwarf-5 -gpubnames -fuse-ld=lld -nostdlib -o %t -flto -x c++ - +RUN: llvm-dwarfdump -debug-names %t | FileCheck %s + +UNSUPPORTED: cygwin,windows-gnu,windows-msvc + +CHECK: String: 0x{{[0-9a-f]*}} "varname" +CHECK-NEXT: Entry +CHECK-NEXT: Abbrev: +CHECK-NEXT: Tag: DW_TAG_variable +CHECK-NEXT: DW_IDX_die_offset: 0x{{[0-9a-f]*}} diff --git a/llvm/test/DebugInfo/X86/unattached-global.ll b/llvm/test/DebugInfo/X86/unattached-global.ll --- a/llvm/test/DebugInfo/X86/unattached-global.ll +++ b/llvm/test/DebugInfo/X86/unattached-global.ll @@ -5,14 +5,14 @@ ; CHECK: DW_TAG_variable ; CHECK: DW_AT_name {{.*}}"a" -; CHECK-NOT: DW_AT_location +; CHECK: DW_AT_location{{ *}}() ; CHECK: DW_TAG !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !5, globals: !1, emissionKind: FullDebug) !1 = !{!2} !2 = !DIGlobalVariableExpression(var: !3, expr: !4) !3 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true, type: !6) -!4 = !DIExpression(DW_OP_plus_uconst, 4) +!4 = !DIExpression() !5 = !DIFile(filename: "", directory: "/") !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)