From 297307653d0e26d236d65fadccb15a21522d845e Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Mon, 7 Oct 2019 17:05:09 +0000 Subject: [PATCH] [Remarks] Pass StringBlockValue as StringRef. After changing the remark serialization, we now pass StringRefs to the serializer. We should use StringRef for StringBlockVal, to avoid creating temporary objects, which then cause StringBlockVal.Value to point to invalid memory. Reviewers: thegameg, anemet Reviewed By: thegameg Differential Revision: https://reviews.llvm.org/D68571 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373923 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Remarks/YAMLRemarkSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Remarks/YAMLRemarkSerializer.cpp b/lib/Remarks/YAMLRemarkSerializer.cpp index 66eb06bbc4f..3a42fe0678e 100644 --- a/lib/Remarks/YAMLRemarkSerializer.cpp +++ b/lib/Remarks/YAMLRemarkSerializer.cpp @@ -103,7 +103,7 @@ template <> struct MappingTraits { /// newlines in strings. struct StringBlockVal { StringRef Value; - StringBlockVal(const std::string &Value) : Value(Value) {} + StringBlockVal(StringRef R) : Value(R) {} }; template <> struct BlockScalarTraits { -- 2.40.0