Skip to content

Commit aff3e68

Browse files
authored
[LLVM][tools] Remove unnecessary newline from error message (llvm#120037)
The previous missing a newline: ```shell $ llc --mattr=help llc: error: unable to get target for 'unknown', see --version and --triple.$ ```
1 parent 95e509a commit aff3e68

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

llvm/lib/MC/TargetRegistry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Target *TargetRegistry::lookupTarget(StringRef ArchName,
126126
[&](const Target &T) { return ArchName == T.getName(); });
127127

128128
if (I == targets().end()) {
129-
Error = ("invalid target '" + ArchName + "'.\n").str();
129+
Error = ("invalid target '" + ArchName + "'.").str();
130130
return nullptr;
131131
}
132132

llvm/test/tools/llc/invalid-target.ll

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
; Check the error message doesn't say error twice.
55

6-
; MARCH: {{.*}}llc{{.*}}: error: invalid target 'arst'.{{$}}
7-
; MTRIPLE: {{.*}}llc{{.*}}: error: unable to get target for 'arst-unknown-unknown', see --version and --triple.{{$}}
6+
; MARCH: {{.*}}llc{{.*}}: error: invalid target 'arst'.
7+
; MARCH-EMPTY:
8+
;
9+
; MTRIPLE: {{.*}}llc{{.*}}: error: unable to get target for 'arst-unknown-unknown', see --version and --triple.
10+
; MTRIPLE-EMPTY:
811

912
define void @func() {
1013
ret void

llvm/tools/llc/llc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
549549
TheTarget =
550550
TargetRegistry::lookupTarget(codegen::getMArch(), TheTriple, Error);
551551
if (!TheTarget) {
552-
WithColor::error(errs(), argv[0]) << Error;
552+
WithColor::error(errs(), argv[0]) << Error << "\n";
553553
exit(1);
554554
}
555555

@@ -592,7 +592,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
592592
TheTarget =
593593
TargetRegistry::lookupTarget(codegen::getMArch(), TheTriple, Error);
594594
if (!TheTarget) {
595-
WithColor::error(errs(), argv[0]) << Error;
595+
WithColor::error(errs(), argv[0]) << Error << "\n";
596596
return 1;
597597
}
598598

0 commit comments

Comments
 (0)