TargetRegistry: Don't add "error" to error messages
Many of the users of this add their own "error:" to the start, resulting in error: error.
This commit is contained in:
parent
1900b6c77b
commit
752c9122a6
|
@ -33,7 +33,7 @@ const Target *TargetRegistry::lookupTarget(const std::string &ArchName,
|
|||
[&](const Target &T) { return ArchName == T.getName(); });
|
||||
|
||||
if (I == targets().end()) {
|
||||
Error = "error: invalid target '" + ArchName + "'.\n";
|
||||
Error = "invalid target '" + ArchName + "'.\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ const Target *TargetRegistry::lookupTarget(const std::string &ArchName,
|
|||
std::string TempError;
|
||||
TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), TempError);
|
||||
if (!TheTarget) {
|
||||
Error = ": error: unable to get target for '"
|
||||
Error = "unable to get target for '"
|
||||
+ TheTriple.getTriple()
|
||||
+ "', see --version and --triple.\n";
|
||||
return nullptr;
|
||||
|
|
11
llvm/test/tools/llc/invalid-target.ll
Normal file
11
llvm/test/tools/llc/invalid-target.ll
Normal file
|
@ -0,0 +1,11 @@
|
|||
; RUN: not llc -march=arst -o /dev/null %s 2>&1 | FileCheck -check-prefix=MARCH %s
|
||||
; RUN: not llc -mtriple=arst-- -o /dev/null %s 2>&1 | FileCheck -check-prefix=MTRIPLE %s
|
||||
|
||||
; 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.{{$}}
|
||||
|
||||
define void @func() {
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user