diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-invalid-source.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-invalid-source.test --- a/llvm/test/tools/llvm-objdump/X86/source-interleave-invalid-source.test +++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-invalid-source.test @@ -13,6 +13,6 @@ # CHECK: main: # CHECK-NEXT: ; int main() { -# WARN: warning: debug info line number 9999 exceeds the number of lines in [[FILE]] +# WARN: warning: debug info line number 9999 exceeds the number of lines in '[[FILE]]' # GOOD: ; int *b = &a; # CHECK: ; return *b + foo(); diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-missing-source.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-missing-source.test --- a/llvm/test/tools/llvm-objdump/X86/source-interleave-missing-source.test +++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-missing-source.test @@ -11,7 +11,7 @@ # RUN: llvm-objdump --source %t2.o | FileCheck %s --check-prefixes=CHECK,SOURCE # RUN: FileCheck %s --input-file %t.e --check-prefixes=WARN -DFILE=%t/source-interleave-x86_64.c -# WARN: warning: failed to find source [[FILE]] +# WARN: warning: failed to find source '[[FILE]]' # CHECK: 0000000000000010 main: # SOURCE-NEXT: ; int main() { # CHECK-NEXT: 10: 55 pushq %rbp 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 @@ -9,7 +9,7 @@ # 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 -DFILE=%t2.o -# WARN: warning: failed to parse debug information for [[FILE]] +# WARN: warning: failed to parse debug information for '[[FILE]]' # CHECK: 0000000000000010 main: # 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 @@ -581,7 +581,8 @@ auto BufferOrError = MemoryBuffer::getFile(LineInfo.FileName); if (!BufferOrError) { if (MissingSources.insert(LineInfo.FileName).second) - warn("failed to find source " + LineInfo.FileName); + warn(formatv("failed to find source '{0}'", LineInfo.FileName)); + return false; } Buffer = std::move(*BufferOrError); @@ -619,8 +620,8 @@ if (LineInfo.FileName == DILineInfo::BadString) { if (!WarnedNoDebugInfo) { - std::string Warning = - "failed to parse debug information for " + ObjectFilename.str(); + std::string Warning = formatv( + "failed to parse debug information for '{0}'", ObjectFilename.str()); if (!ErrorMessage.empty()) Warning += ": " + ErrorMessage; warn(Warning); @@ -643,7 +644,7 @@ if (LineBuffer != LineCache.end()) { if (LineInfo.Line > LineBuffer->second.size()) { warn(formatv( - "debug info line number {0} exceeds the number of lines in {1}", + "debug info line number {0} exceeds the number of lines in '{1}'", LineInfo.Line, LineInfo.FileName)); return; }