[PATCH] D22984: [lldb][tsan] Avoid some string copies (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 18:38:52 PDT 2016
vsk retitled this revision from "[lldb][tsan] Avoid a string copy (NFC)" to "[lldb][tsan] Avoid some string copies (NFC)".
vsk updated this revision to Diff 66208.
vsk added a comment.
- Catch a few more copies pointed out by @compnerd.
https://reviews.llvm.org/D22984
Files:
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
Index: source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
===================================================================
--- source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -273,7 +273,7 @@
)";
static StructuredData::Array *
-CreateStackTrace(ValueObjectSP o, std::string trace_item_name = ".trace") {
+CreateStackTrace(ValueObjectSP o, const std::string &trace_item_name = ".trace") {
StructuredData::Array *trace = new StructuredData::Array();
ValueObjectSP trace_value_object = o->GetValueForExpressionPath(trace_item_name.c_str());
for (int j = 0; j < 8; j++) {
@@ -286,7 +286,7 @@
}
static StructuredData::Array *
-ConvertToStructuredArray(ValueObjectSP return_value_sp, std::string items_name, std::string count_name, std::function <void(ValueObjectSP o, StructuredData::Dictionary *dict)> const &callback)
+ConvertToStructuredArray(ValueObjectSP return_value_sp, const std::string &items_name, const std::string &count_name, std::function <void(ValueObjectSP o, StructuredData::Dictionary *dict)> const &callback)
{
StructuredData::Array *array = new StructuredData::Array();
unsigned int count = return_value_sp->GetValueForExpressionPath(count_name.c_str())->GetValueAsUnsigned(0);
@@ -303,7 +303,7 @@
}
static std::string
-RetrieveString(ValueObjectSP return_value_sp, ProcessSP process_sp, std::string expression_path)
+RetrieveString(ValueObjectSP return_value_sp, ProcessSP process_sp, const std::string &expression_path)
{
addr_t ptr = return_value_sp->GetValueForExpressionPath(expression_path.c_str())->GetValueAsUnsigned(0);
std::string str;
@@ -786,7 +786,7 @@
}
static std::string
-GenerateThreadName(std::string path, StructuredData::Object *o, StructuredData::ObjectSP main_info) {
+GenerateThreadName(const std::string &path, StructuredData::Object *o, StructuredData::ObjectSP main_info) {
std::string result = "additional information";
if (path == "mops") {
@@ -838,7 +838,7 @@
}
static void
-AddThreadsForPath(std::string path, ThreadCollectionSP threads, ProcessSP process_sp, StructuredData::ObjectSP info)
+AddThreadsForPath(const std::string &path, ThreadCollectionSP threads, ProcessSP process_sp, StructuredData::ObjectSP info)
{
info->GetObjectForDotSeparatedPath(path)->GetAsArray()->ForEach([process_sp, threads, path, info] (StructuredData::Object *o) -> bool {
std::vector<lldb::addr_t> pcs;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22984.66208.patch
Type: text/x-patch
Size: 2572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160730/ede176d3/attachment.bin>
More information about the llvm-commits
mailing list