Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/MC/TargetRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions llvm/test/tools/llc/invalid-target.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/tools/llc/llc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}

Expand Down
Loading