Many of the users of this add their own "error:" to the start,
resulting in error: error.
[&](const Target &T) { return ArchName == T.getName(); });
if (I == targets().end()) {
- Error = "error: invalid target '" + ArchName + "'.\n";
+ Error = "invalid target '" + ArchName + "'.\n";
return nullptr;
}
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;
--- /dev/null
+; 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
+}