================
@@ -342,9 +342,9 @@ SarifDocumentWriter::createCodeFlow(ArrayRef<ThreadFlow>
ThreadFlows) {
return json::Object{{"threadFlows", createThreadFlows(ThreadFlows)}};
}
-void SarifDocumentWriter::createRun(StringRef ShortToolName,
- StringRef LongToolName,
- StringRef ToolVersion) {
+void SarifDocumentWriter::createRun(std::string ShortToolName,
+ std::string LongToolName,
+ std::string ToolVersion) {
----------------
dbartol wrote:
The original bug was because `json::Value` (used in the initializer list to
`json::Object`) has a constructor overload for `StringRef` that captures the
string by reference. I can see why that functionality is useful, but it's easy
to get the lifetimes wrong when that behavior is implicit. I thought it was
more clear to make `createRun` take owning strings than it was to make sure
that wherever I used the `StringRef` arguments I remembered to convert them to
`std::string`.
https://github.com/llvm/llvm-project/pull/185201
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits