PR45561: Return a literal string rather than an error string to avoid returning refer...
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 15 Apr 2020 21:26:31 +0000 (14:26 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 15 Apr 2020 21:27:29 +0000 (14:27 -0700)
Changing the underlying YAML support to allow returning a literal
string, rather than a StringRef, would probably be a bigger refactor so
I didn't do that.

llvm/lib/TextAPI/MachO/TextStub.cpp

index 57e3318..db6762f 100644 (file)
@@ -412,8 +412,10 @@ template <> struct ScalarTraits<Target> {
 
   static StringRef input(StringRef Scalar, void *, Target &Value) {
     auto Result = Target::create(Scalar);
-    if (!Result)
-      return toString(Result.takeError());
+    if (!Result) {
+      consumeError(Result.takeError());
+      return "unparsable target";
+    }
 
     Value = *Result;
     if (Value.Arch == AK_unknown)