Skip to content

Commit 274b7cb

Browse files
committed
[clang-format] Print the names of unfound files in error messages
Fixes #113631.
1 parent 78e7d95 commit 274b7cb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: rm -f a.c b.c
2+
3+
// RUN: not clang-format a.c b.c 2>&1 | FileCheck %s
4+
// CHECK: a.c:
5+
// CHECK-NEXT: b.c:
6+
7+
// rm -f a.c b.c

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
419419
? MemoryBuffer::getFileAsStream(FileName)
420420
: MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true);
421421
if (std::error_code EC = CodeOrErr.getError()) {
422-
errs() << EC.message() << "\n";
422+
errs() << FileName << ": " << EC.message() << "\n";
423423
return true;
424424
}
425425
std::unique_ptr<llvm::MemoryBuffer> Code = std::move(CodeOrErr.get());

0 commit comments

Comments
 (0)