diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-no-debug-info.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-no-debug-info.test --- a/llvm/test/tools/llvm-objdump/X86/source-interleave-no-debug-info.test +++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-no-debug-info.test @@ -1,5 +1,5 @@ ## Test that if an object has no debug information, only the disassembly is -## printed when --source is specified, and that we emit a warning. +## printed when --source is specified, and that we do not emit a warning. # RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll # RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll @@ -7,9 +7,8 @@ # RUN: llvm-objdump --source %t.o | FileCheck %s --check-prefixes=CHECK,SOURCE # RUN: llvm-objdump --source %t2.o 2> %t2.e | FileCheck %s --check-prefixes=CHECK --implicit-check-not='main()' -# RUN: FileCheck %s --input-file %t2.e --check-prefixes=WARN +# RUN: count 0 < %t2.e -# WARN: warning: '{{.*}}2.o': failed to parse debug information # CHECK: 0000000000000010
: # SOURCE-NEXT: ; int main() { # CHECK-NEXT: 10: 55 pushq %rbp diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -942,8 +942,6 @@ std::unordered_map> LineCache; // Keep track of missing sources. StringSet<> MissingSources; - // Only emit 'no debug info' warning once. - bool WarnedNoDebugInfo; private: bool cacheSource(const DILineInfo& LineInfoFile); @@ -957,8 +955,7 @@ public: SourcePrinter() = default; - SourcePrinter(const ObjectFile *Obj, StringRef DefaultArch) - : Obj(Obj), WarnedNoDebugInfo(false) { + SourcePrinter(const ObjectFile *Obj, StringRef DefaultArch) : Obj(Obj) { symbolize::LLVMSymbolizer::Options SymbolizerOpts; SymbolizerOpts.PrintFunctions = DILineInfoSpecifier::FunctionNameKind::LinkageName; @@ -1015,20 +1012,13 @@ DILineInfo LineInfo = DILineInfo(); auto ExpectedLineInfo = Symbolizer->symbolizeCode(*Obj, Address); std::string ErrorMessage; - if (!ExpectedLineInfo) - ErrorMessage = toString(ExpectedLineInfo.takeError()); - else + if (ExpectedLineInfo) { LineInfo = *ExpectedLineInfo; - - if (LineInfo.FileName == DILineInfo::BadString) { - if (!WarnedNoDebugInfo) { - std::string Warning = - "failed to parse debug information for " + ObjectFilename.str(); - if (!ErrorMessage.empty()) - Warning += ": " + ErrorMessage; - reportWarning(Warning, ObjectFilename); - WarnedNoDebugInfo = true; - } + } else { + // TODO Untested. + reportWarning("failed to parse debug information for " + ObjectFilename + + ": " + toString(ExpectedLineInfo.takeError()), + ObjectFilename); } if (PrintLines)