[LLVM][tools] Remove unnecessary newline from error message (#120037)

The previous missing a newline:
```shell
$ llc --mattr=help
llc: error: unable to get target for 'unknown', see --version and --triple.$
```
This commit is contained in:
Shao-Ce SUN 2024-12-16 17:45:58 +08:00 committed by GitHub
parent 95e509a989
commit aff3e68d6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View File

@ -126,7 +126,7 @@ const Target *TargetRegistry::lookupTarget(StringRef ArchName,
[&](const Target &T) { return ArchName == T.getName(); });
if (I == targets().end()) {
Error = ("invalid target '" + ArchName + "'.\n").str();
Error = ("invalid target '" + ArchName + "'.").str();
return nullptr;
}

View File

@ -3,8 +3,11 @@
; Check the error message doesn't say error twice.
; MARCH: {{.*}}llc{{.*}}: error: invalid target 'arst'.{{$}}
; MTRIPLE: {{.*}}llc{{.*}}: error: unable to get target for 'arst-unknown-unknown', see --version and --triple.{{$}}
; MARCH: {{.*}}llc{{.*}}: error: invalid target 'arst'.
; MARCH-EMPTY:
;
; MTRIPLE: {{.*}}llc{{.*}}: error: unable to get target for 'arst-unknown-unknown', see --version and --triple.
; MTRIPLE-EMPTY:
define void @func() {
ret void

View File

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