[PATCH] D68571: [Remarks] Pass StringBlockValue as StringRef.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 05:27:21 PDT 2019
fhahn created this revision.
fhahn added reviewers: thegameg, anemet.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68571
Files:
llvm/lib/Remarks/YAMLRemarkSerializer.cpp
Index: llvm/lib/Remarks/YAMLRemarkSerializer.cpp
===================================================================
--- llvm/lib/Remarks/YAMLRemarkSerializer.cpp
+++ llvm/lib/Remarks/YAMLRemarkSerializer.cpp
@@ -103,7 +103,7 @@
/// newlines in strings.
struct StringBlockVal {
StringRef Value;
- StringBlockVal(const std::string &Value) : Value(Value) {}
+ StringBlockVal(StringRef R) : Value(R) {}
};
template <> struct BlockScalarTraits<StringBlockVal> {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68571.223523.patch
Type: text/x-patch
Size: 469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191007/de76766e/attachment.bin>
More information about the llvm-commits
mailing list