================
@@ -265,22 +265,21 @@ Expected<StringRef> 
YAMLRemarkParser::parseKey(yaml::KeyValueNode &Node) {
 }
 
 Expected<StringRef> YAMLRemarkParser::parseStr(yaml::KeyValueNode &Node) {
-  auto *Value = dyn_cast_if_present<yaml::ScalarNode>(Node.getValue());
-  yaml::BlockScalarNode *ValueBlock;
-  StringRef Result;
-  if (!Value) {
-    // Try to parse the value as a block node.
-    ValueBlock = dyn_cast_if_present<yaml::BlockScalarNode>(Node.getValue());
-    if (!ValueBlock)
-      return error("expected a value of scalar type.", Node);
-    Result = ValueBlock->getValue();
-  } else
-    Result = Value->getRawValue();
-
-  Result.consume_front("\'");
-  Result.consume_back("\'");
-
-  return Result;
+  yaml::Node *Value = Node.getValue();
+  // A block value lives in the YAML document, which next() frees before
+  // returning the remark.
+  if (auto *Block = dyn_cast_if_present<yaml::BlockScalarNode>(Value))
+    return Block->getValue().copy(Alloc);
+
----------------
xlauko wrote:

Yes, split out into #228072 This PR now sits on top of it.

https://github.com/llvm/llvm-project/pull/227654
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to