Skip to content

Commit 2f1c212

Browse files
committed
PR45561: Return a literal string rather than an error string to avoid returning reference to local
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.
1 parent 50472c4 commit 2f1c212

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/TextAPI/MachO/TextStub.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,10 @@ template <> struct ScalarTraits<Target> {
412412

413413
static StringRef input(StringRef Scalar, void *, Target &Value) {
414414
auto Result = Target::create(Scalar);
415-
if (!Result)
416-
return toString(Result.takeError());
415+
if (!Result) {
416+
consumeError(Result.takeError());
417+
return "unparsable target";
418+
}
417419

418420
Value = *Result;
419421
if (Value.Arch == AK_unknown)

0 commit comments

Comments
 (0)