[llvm] aff3e68 - [LLVM][tools] Remove unnecessary newline from error message (#120037)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 01:46:01 PST 2024
Author: Shao-Ce SUN
Date: 2024-12-16T17:45:58+08:00
New Revision: aff3e68d6f10dd3087c29a09865683b9d35a362e
URL: https://github.com/llvm/llvm-project/commit/aff3e68d6f10dd3087c29a09865683b9d35a362e
DIFF: https://github.com/llvm/llvm-project/commit/aff3e68d6f10dd3087c29a09865683b9d35a362e.diff
LOG: [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.$
```
Added:
Modified:
llvm/lib/MC/TargetRegistry.cpp
llvm/test/tools/llc/invalid-target.ll
llvm/tools/llc/llc.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/TargetRegistry.cpp b/llvm/lib/MC/TargetRegistry.cpp
index 3be6f1d4634990..e1879f97aa5675 100644
--- a/llvm/lib/MC/TargetRegistry.cpp
+++ b/llvm/lib/MC/TargetRegistry.cpp
@@ -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;
}
diff --git a/llvm/test/tools/llc/invalid-target.ll b/llvm/test/tools/llc/invalid-target.ll
index 6eed627b0115d9..7cbb171c7225e1 100644
--- a/llvm/test/tools/llc/invalid-target.ll
+++ b/llvm/test/tools/llc/invalid-target.ll
@@ -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
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 150dd50ef2936e..3694ff79b54364 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -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;
}
More information about the llvm-commits
mailing list