aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 20:23:46 +0100
committerBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 23:25:25 +0100
commitadcd02683856c30ba6f349279509acecd90063df (patch)
tree7b5927ef2ecab1618842183fac5ebe848f5832dd /lldb/source/Plugins
parent5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff)
downloadllvm-adcd02683856c30ba6f349279509acecd90063df.zip
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.gz
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.bz2
Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp4
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp13
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp5
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp6
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp8
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp8
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp42
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp3
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp6
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp32
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp2
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp2
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp2
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp2
-rw-r--r--lldb/source/Plugins/Platform/Android/AdbClient.cpp4
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp2
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp2
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp2
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp4
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp13
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/ThreadMemory.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp35
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp47
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h2
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp4
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp14
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp8
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp24
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp8
43 files changed, 181 insertions, 160 deletions
diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index 0cf0c63..e9399c3 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -367,7 +367,7 @@ public:
}
break;
}
- m_mnemonics = mnemonic_strm.GetString();
+ m_mnemonics = std::string(mnemonic_strm.GetString());
return;
} else {
if (m_does_branch == eLazyBoolCalculate) {
@@ -1414,7 +1414,7 @@ const char *DisassemblerLLVMC::SymbolLookup(uint64_t value, uint64_t *type_ptr,
// If Address::Dump returned a multi-line description, most commonly
// seen when we have multiple levels of inlined functions at an
// address, only show the first line.
- std::string str = ss.GetString();
+ std::string str = std::string(ss.GetString());
size_t first_eol_char = str.find_first_of("\r\n");
if (first_eol_char != std::string::npos) {
str.erase(first_eol_char);
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index f6f2203..4940564 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -383,9 +383,10 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
mh->GetValueForKey("filetype")->GetAsInteger()->GetValue();
if (image->HasKey("min_version_os_name")) {
- std::string os_name = image->GetValueForKey("min_version_os_name")
- ->GetAsString()
- ->GetValue();
+ std::string os_name =
+ std::string(image->GetValueForKey("min_version_os_name")
+ ->GetAsString()
+ ->GetValue());
if (os_name == "macosx")
image_infos[i].os_type = llvm::Triple::MacOSX;
else if (os_name == "ios" || os_name == "iphoneos")
@@ -403,9 +404,9 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
}
if (image->HasKey("min_version_os_sdk")) {
image_infos[i].min_version_os_sdk =
- image->GetValueForKey("min_version_os_sdk")
- ->GetAsString()
- ->GetValue();
+ std::string(image->GetValueForKey("min_version_os_sdk")
+ ->GetAsString()
+ ->GetValue());
}
// Fields that aren't used by DynamicLoaderDarwin so debugserver doesn't
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index 1563279..a9e674e 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -481,8 +481,8 @@ bool DynamicLoaderMacOS::GetSharedCacheInformation(
info_dict->HasKey("shared_cache_base_address")) {
base_address = info_dict->GetValueForKey("shared_cache_base_address")
->GetIntegerValue(LLDB_INVALID_ADDRESS);
- std::string uuid_str =
- info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue();
+ std::string uuid_str = std::string(
+ info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue());
if (!uuid_str.empty())
uuid.SetFromStringRef(uuid_str);
if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue())
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index bc481aa..eeab419 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -207,7 +207,8 @@ public:
if (make_new_diagnostic) {
// ClangDiagnostic messages are expected to have no whitespace/newlines
// around them.
- std::string stripped_output = llvm::StringRef(m_output).trim();
+ std::string stripped_output =
+ std::string(llvm::StringRef(m_output).trim());
auto new_diagnostic = std::make_unique<ClangDiagnostic>(
stripped_output, severity, Info.getID());
@@ -255,7 +256,7 @@ static void SetupModuleHeaderPaths(CompilerInstance *compiler,
llvm::SmallString<128> module_cache;
const auto &props = ModuleList::GetGlobalModuleListProperties();
props.GetClangModulesCachePath().GetPath(module_cache);
- search_opts.ModuleCachePath = module_cache.str();
+ search_opts.ModuleCachePath = std::string(module_cache.str());
LLDB_LOG(log, "Using module cache path: {0}", module_cache.c_str());
search_opts.ResourceDir = GetClangResourceDir().GetPath();
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
index b4b4ec3..8d4da62f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -478,7 +478,7 @@ bool ClangExpressionSourceCode::GetText(
break;
}
- text = wrap_stream.GetString();
+ text = std::string(wrap_stream.GetString());
} else {
text.append(m_body);
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 75f32c3..c6eb451 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -606,7 +606,7 @@ ClangModulesDeclVendor::Create(Target &target) {
const auto &props = ModuleList::GetGlobalModuleListProperties();
props.GetClangModulesCachePath().GetPath(path);
std::string module_cache_argument("-fmodules-cache-path=");
- module_cache_argument.append(path.str());
+ module_cache_argument.append(std::string(path.str()));
compiler_invocation_arguments.push_back(module_cache_argument);
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
index 51ae7328..f1272c6 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
@@ -73,7 +73,7 @@ CppModuleConfiguration::CppModuleConfiguration(
llvm::SmallString<256> resource_dir;
llvm::sys::path::append(resource_dir, GetClangResourceDir().GetPath(),
"include");
- m_resource_inc = resource_dir.str();
+ m_resource_inc = std::string(resource_dir.str());
// This order matches the way Clang orders these directories.
m_include_dirs = {m_std_inc.Get(), m_resource_inc, m_c_inc.Get()};
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 19df34d..0a0314d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -823,7 +823,8 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
if (!omvn_initializer_array->isString())
return false;
- std::string omvn_initializer_string = omvn_initializer_array->getAsString();
+ std::string omvn_initializer_string =
+ std::string(omvn_initializer_array->getAsString());
LLDB_LOG(log, "Found Objective-C selector reference \"{0}\"",
omvn_initializer_string);
@@ -981,7 +982,8 @@ bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
if (!ocn_initializer_array->isString())
return false;
- std::string ocn_initializer_string = ocn_initializer_array->getAsString();
+ std::string ocn_initializer_string =
+ std::string(ocn_initializer_array->getAsString());
LLDB_LOG(log, "Found Objective-C class reference \"{0}\"",
ocn_initializer_string);
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp
index 178a361..6cba7ef 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp
@@ -190,10 +190,10 @@ StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() {
std::string
InstrumentationRuntimeASan::FormatDescription(StructuredData::ObjectSP report) {
- std::string description = report->GetAsDictionary()
- ->GetValueForKey("description")
- ->GetAsString()
- ->GetValue();
+ std::string description = std::string(report->GetAsDictionary()
+ ->GetValueForKey("description")
+ ->GetAsString()
+ ->GetValue());
return llvm::StringSwitch<std::string>(description)
.Case("heap-use-after-free", "Use of deallocated memory")
.Case("heap-buffer-overflow", "Heap buffer overflow")
diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
index 065a85b..4c2173f 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
@@ -178,10 +178,10 @@ bool InstrumentationRuntimeMainThreadChecker::NotifyBreakpointHit(
instance->RetrieveReportData(context->exe_ctx_ref);
if (report) {
- std::string description = report->GetAsDictionary()
- ->GetValueForKey("description")
- ->GetAsString()
- ->GetValue();
+ std::string description = std::string(report->GetAsDictionary()
+ ->GetValueForKey("description")
+ ->GetAsString()
+ ->GetValue());
thread_sp->SetStopInfo(
InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData(
*thread_sp, description, report));
diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
index 24f1a9a..2f93b51 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -487,10 +487,10 @@ StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData(
std::string
InstrumentationRuntimeTSan::FormatDescription(StructuredData::ObjectSP report) {
- std::string description = report->GetAsDictionary()
- ->GetValueForKey("issue_type")
- ->GetAsString()
- ->GetValue();
+ std::string description = std::string(report->GetAsDictionary()
+ ->GetValueForKey("issue_type")
+ ->GetAsString()
+ ->GetValue());
if (description == "data-race") {
return "Data race";
@@ -536,7 +536,7 @@ static std::string Sprintf(const char *format, ...) {
va_start(args, format);
s.PrintfVarArg(format, args);
va_end(args);
- return s.GetString();
+ return std::string(s.GetString());
}
static std::string GetSymbolNameFromAddress(ProcessSP process_sp, addr_t addr) {
@@ -612,10 +612,10 @@ std::string
InstrumentationRuntimeTSan::GenerateSummary(StructuredData::ObjectSP report) {
ProcessSP process_sp = GetProcessSP();
- std::string summary = report->GetAsDictionary()
- ->GetValueForKey("description")
- ->GetAsString()
- ->GetValue();
+ std::string summary = std::string(report->GetAsDictionary()
+ ->GetValueForKey("description")
+ ->GetAsString()
+ ->GetValue());
bool skip_one_frame =
report->GetObjectForDotSeparatedPath("issue_type")->GetStringValue() ==
"external-race";
@@ -657,10 +657,10 @@ InstrumentationRuntimeTSan::GenerateSummary(StructuredData::ObjectSP report) {
->GetValueForKey("locs")
->GetAsArray()
->GetItemAtIndex(0);
- std::string object_type = loc->GetAsDictionary()
- ->GetValueForKey("object_type")
- ->GetAsString()
- ->GetValue();
+ std::string object_type = std::string(loc->GetAsDictionary()
+ ->GetValueForKey("object_type")
+ ->GetAsString()
+ ->GetValue());
if (!object_type.empty()) {
summary = "Race on " + object_type + " object";
}
@@ -726,8 +726,8 @@ std::string InstrumentationRuntimeTSan::GetLocationDescription(
->GetValueForKey("locs")
->GetAsArray()
->GetItemAtIndex(0);
- std::string type =
- loc->GetAsDictionary()->GetValueForKey("type")->GetStringValue();
+ std::string type = std::string(
+ loc->GetAsDictionary()->GetValueForKey("type")->GetStringValue());
if (type == "global") {
global_addr = loc->GetAsDictionary()
->GetValueForKey("address")
@@ -756,10 +756,10 @@ std::string InstrumentationRuntimeTSan::GetLocationDescription(
->GetValueForKey("size")
->GetAsInteger()
->GetValue();
- std::string object_type = loc->GetAsDictionary()
- ->GetValueForKey("object_type")
- ->GetAsString()
- ->GetValue();
+ std::string object_type = std::string(loc->GetAsDictionary()
+ ->GetValueForKey("object_type")
+ ->GetAsString()
+ ->GetValue());
if (!object_type.empty()) {
result = Sprintf("Location is a %ld-byte %s object at 0x%llx", size,
object_type.c_str(), addr);
@@ -978,8 +978,8 @@ static std::string GenerateThreadName(const std::string &path,
}
if (path == "locs") {
- std::string type =
- o->GetAsDictionary()->GetValueForKey("type")->GetStringValue();
+ std::string type = std::string(
+ o->GetAsDictionary()->GetValueForKey("type")->GetStringValue());
int thread_id =
o->GetObjectForDotSeparatedPath("thread_id")->GetIntegerValue();
int fd =
diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
index 3c0e22e..94611e8 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
@@ -183,7 +183,8 @@ static std::string GetStopReasonDescription(StructuredData::ObjectSP report) {
llvm::StringRef stop_reason_description_ref;
report->GetAsDictionary()->GetValueForKeyAsString(
"description", stop_reason_description_ref);
- std::string stop_reason_description = stop_reason_description_ref;
+ std::string stop_reason_description =
+ std::string(stop_reason_description_ref);
if (!stop_reason_description.size()) {
stop_reason_description = "Undefined behavior detected";
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9267c61..b5992ba 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -230,7 +230,7 @@ std::string CPlusPlusLanguage::MethodName::GetScopeQualifiedName() {
if (!m_parsed)
Parse();
if (m_context.empty())
- return m_basename;
+ return std::string(m_basename);
std::string res;
res += m_context;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 2565e01..7e72f94 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -32,7 +32,7 @@ std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
StreamString buffer;
while (type.HasAtLeast(1) && type.Peek() != '=')
buffer.Printf("%c", type.Next());
- return buffer.GetString();
+ return std::string(buffer.GetString());
}
std::string AppleObjCTypeEncodingParser::ReadQuotedString(StringLexer &type) {
@@ -42,7 +42,7 @@ std::string AppleObjCTypeEncodingParser::ReadQuotedString(StringLexer &type) {
StringLexer::Character next = type.Next();
UNUSED_IF_ASSERT_DISABLED(next);
assert(next == '"');
- return buffer.GetString();
+ return std::string(buffer.GetString());
}
uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) {
@@ -131,7 +131,7 @@ clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
if (element.name.empty()) {
StreamString elem_name;
elem_name.Printf("__unnamed_%u", count);
- element.name = elem_name.GetString();
+ element.name = std::string(elem_name.GetString());
}
TypeSystemClang::AddFieldToRecordType(
union_type, element.name.c_str(), ast_ctx.GetType(element.type),
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
index 03fdffb..6ed04dd 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -220,22 +220,22 @@ bool AppleThreadPlanStepThroughObjCTrampoline::WillStop() { return true; }
// since we can't just return control to the plan that's controlling us on the
// first step.
-AppleThreadPlanStepThroughDirectDispatch
- ::AppleThreadPlanStepThroughDirectDispatch(
- Thread &thread, AppleObjCTrampolineHandler &handler,
- llvm::StringRef dispatch_func_name, bool stop_others,
- LazyBool step_in_avoids_code_without_debug_info)
- : ThreadPlanStepOut(thread, nullptr, true /* first instruction */,
- stop_others,
- eVoteNoOpinion, eVoteNoOpinion,
- 0 /* Step out of zeroth frame */,
- eLazyBoolNo /* Our parent plan will decide this
- when we are done */,
- true /* Run to branch for inline step out */,
- false /* Don't gather the return value */),
- m_trampoline_handler(handler),
- m_dispatch_func_name(dispatch_func_name), m_at_msg_send(false),
- m_stop_others(stop_others) {
+AppleThreadPlanStepThroughDirectDispatch ::
+ AppleThreadPlanStepThroughDirectDispatch(
+ Thread &thread, AppleObjCTrampolineHandler &handler,
+ llvm::StringRef dispatch_func_name, bool stop_others,
+ LazyBool step_in_avoids_code_without_debug_info)
+ : ThreadPlanStepOut(thread, nullptr, true /* first instruction */,
+ stop_others, eVoteNoOpinion, eVoteNoOpinion,
+ 0 /* Step out of zeroth frame */,
+ eLazyBoolNo /* Our parent plan will decide this
+ when we are done */
+ ,
+ true /* Run to branch for inline step out */,
+ false /* Don't gather the return value */),
+ m_trampoline_handler(handler),
+ m_dispatch_func_name(std::string(dispatch_func_name)),
+ m_at_msg_send(false), m_stop_others(stop_others) {
// Set breakpoints on the dispatch functions:
auto bkpt_callback = [&] (lldb::addr_t addr,
const AppleObjCTrampolineHandler
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
index f96065d..6858c71 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
@@ -86,7 +86,7 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
llvm::StringRef real_triple =
m_process_ptr->GetTarget().GetArchitecture().GetTriple().getTriple();
const llvm::Target *target_info =
- llvm::TargetRegistry::lookupTarget(real_triple, err);
+ llvm::TargetRegistry::lookupTarget(std::string(real_triple), err);
if (!target_info) {
if (log)
log->Warning("couldn't determine real target architecture: '%s'",
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index affceea..ad58f8c 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -1513,7 +1513,7 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook,
script->type = ScriptDetails::eScriptC;
script->cache_dir = cache_dir;
script->res_name = res_name;
- script->shared_lib = strm.GetString();
+ script->shared_lib = std::string(strm.GetString());
script->context = addr_t(args[eRsContext]);
}
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index bb0bd04..f5bca5b 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1696,7 +1696,7 @@ class VMAddressProvider {
public:
VMAddressProvider(ObjectFile::Type Type, llvm::StringRef SegmentName)
- : ObjectType(Type), SegmentName(SegmentName) {}
+ : ObjectType(Type), SegmentName(std::string(SegmentName)) {}
std::string GetNextSegmentName() const {
return llvm::formatv("{0}[{1}]", SegmentName, SegmentCount).str();
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index a934ac8..8f10531 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -1169,7 +1169,7 @@ void ObjectFilePECOFF::DumpOptCOFFHeader(Stream *s,
// Dump a single ELF section header to the specified output stream
void ObjectFilePECOFF::DumpSectionHeader(Stream *s,
const section_header_t &sh) {
- std::string name = GetSectionName(sh);
+ std::string name = std::string(GetSectionName(sh));
s->Printf("%-16s 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x 0x%4.4x "
"0x%4.4x 0x%8.8x\n",
name.c_str(), sh.vmaddr, sh.vmsize, sh.offset, sh.size, sh.reloff,
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 442e31c..c24af00 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -337,7 +337,7 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
m_interpreter->OSPlugin_RegisterContextData(m_python_object_sp,
thread->GetID());
if (reg_context_data) {
- std::string value = reg_context_data->GetValue();
+ std::string value = std::string(reg_context_data->GetValue());
DataBufferSP data_sp(new DataBufferHeap(value.c_str(), value.length()));
if (data_sp->GetByteSize()) {
RegisterContextMemory *reg_ctx_memory = new RegisterContextMemory(
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
index 9ef9691..81698b7 100644
--- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
@@ -166,7 +166,7 @@ Status AdbClient::GetDevices(DeviceIDList &device_list) {
response.split(devices, "\n", -1, false);
for (const auto &device : devices)
- device_list.push_back(device.split('\t').first);
+ device_list.push_back(std::string(device.split('\t').first));
// Force disconnect since ADB closes connection after host:devices response
// is sent.
@@ -365,7 +365,7 @@ Status AdbClient::internalShell(const char *command, milliseconds timeout,
StreamString adb_command;
adb_command.Printf("shell:%s", command);
- error = SendMessage(adb_command.GetString(), false);
+ error = SendMessage(std::string(adb_command.GetString()), false);
if (error.Fail())
return error;
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index e68c5e8..25fbc5c 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -170,7 +170,7 @@ Status PlatformAndroid::ConnectRemote(Args &args) {
if (!UriParser::Parse(url, scheme, host, port, path))
return Status("Invalid URL: %s", url);
if (host != "localhost")
- m_device_id = host;
+ m_device_id = std::string(host);
auto error = PlatformLinux::ConnectRemote(args);
if (error.Success()) {
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index 5954d33..a94ead1 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -117,7 +117,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
if (!UriParser::Parse(url, scheme, host, remote_port, path))
return Status("Invalid URL: %s", url);
if (host != "localhost")
- m_device_id = host;
+ m_device_id = std::string(host);
m_socket_namespace.reset();
if (scheme == ConnectionFileDescriptor::UNIX_CONNECT_SCHEME)
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 16602dd..2a745f7 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1562,7 +1562,7 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
minimum_version_option.PutCString("-mmacosx-version-min=");
minimum_version_option.PutCString(version.getAsString());
}
- options.push_back(minimum_version_option.GetString());
+ options.push_back(std::string(minimum_version_option.GetString()));
}
FileSpec sysroot_spec;
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index ee89aca..0185ba4 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -429,7 +429,7 @@ std::string PlatformPOSIX::GetPlatformSpecificConnectionInformation() {
if (GetLocalCacheDirectory() && *GetLocalCacheDirectory())
stream.Printf("cache dir: %s", GetLocalCacheDirectory());
if (stream.GetSize())
- return stream.GetString();
+ return std::string(stream.GetString());
else
return "";
}
@@ -679,7 +679,7 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
static const char *dlopen_wrapper_name = "__lldb_dlopen_wrapper";
Process *process = exe_ctx.GetProcessSP().get();
// Insert the dlopen shim defines into our generic expression:
- std::string expr(GetLibdlFunctionDeclarations(process));
+ std::string expr(std::string(GetLibdlFunctionDeclarations(process)));
expr.append(dlopen_wrapper_code);
Status utility_error;
DiagnosticManager diagnostics;
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 74e5548..8af55ab 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -298,9 +298,9 @@ Status PlatformRemoteGDBServer::ConnectRemote(Args &args) {
llvm::StringRef scheme, hostname, pathname;
if (!UriParser::Parse(url, scheme, hostname, port, pathname))
return Status("Invalid URL: %s", url);
- m_platform_scheme = scheme;
- m_platform_hostname = hostname;
- path = pathname;
+ m_platform_scheme = std::string(scheme);
+ m_platform_hostname = std::string(hostname);
+ path = std::string(pathname);
const ConnectionStatus status = m_gdb_client.Connect(url, &error);
if (status == eConnectionStatusSuccess) {
@@ -725,7 +725,8 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() {
response.GetResponseType() != response.eResponse)
return m_remote_signals_sp;
- auto object_sp = StructuredData::ParseJSON(response.GetStringRef());
+ auto object_sp =
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
if (!object_sp || !object_sp->IsValid())
return m_remote_signals_sp;
@@ -772,7 +773,7 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() {
std::string description{""};
object_sp = dict->GetValueForKey("description");
if (object_sp && object_sp->IsValid())
- description = object_sp->GetStringValue();
+ description = std::string(object_sp->GetStringValue());
remote_signals_sp->AddSignal(signo, name.str().c_str(), suppress, stop,
notify, description.c_str());
@@ -811,7 +812,7 @@ std::string PlatformRemoteGDBServer::MakeUrl(const char *scheme,
result.Printf(":%u", port);
if (path)
result.Write(path, strlen(path));
- return result.GetString();
+ return std::string(result.GetString());
}
lldb::ProcessSP PlatformRemoteGDBServer::ConnectProcess(
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 3edef53..14eea2d 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -99,7 +99,7 @@ std::string NativeThreadLinux::GetName() {
auto BufferOrError = getProcFile(process.GetID(), GetID(), "comm");
if (!BufferOrError)
return "";
- return BufferOrError.get()->getBuffer().rtrim('\n');
+ return std::string(BufferOrError.get()->getBuffer().rtrim('\n'));
}
lldb::StateType NativeThreadLinux::GetState() { return m_state; }
diff --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
index 7331fc1..2d8e8ef 100644
--- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -290,7 +290,7 @@ const char *StopInfoMachException::GetDescription() {
if (m_exc_data_count > 0)
strm.PutChar(')');
- m_description = strm.GetString();
+ m_description = std::string(strm.GetString());
return m_description.c_str();
}
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
index d3e0656..9016e14 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -29,7 +29,8 @@ ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
llvm::StringRef name, llvm::StringRef queue,
lldb::addr_t register_data_addr)
: Thread(process, tid), m_backing_thread_sp(), m_thread_info_valobj_sp(),
- m_name(name), m_queue(queue), m_register_data_addr(register_data_addr) {}
+ m_name(std::string(name)), m_queue(std::string(queue)),
+ m_register_data_addr(register_data_addr) {}
ThreadMemory::~ThreadMemory() { DestroyThread(); }
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
index 10362b6..fdaa60e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
@@ -41,7 +41,7 @@ StateType GDBRemoteClientBase::SendContinuePacketAndWaitForResponse(
{
std::lock_guard<std::mutex> lock(m_mutex);
- m_continue_packet = payload;
+ m_continue_packet = std::string(payload);
m_should_stop = false;
}
ContinueLock cont_lock(*this);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 6e6576e..5440367 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -125,7 +125,7 @@ GDBRemoteCommunication::SendPacketNoLock(llvm::StringRef payload) {
packet.Write(payload.data(), payload.size());
packet.PutChar('#');
packet.PutHex8(CalculcateChecksum(payload));
- std::string packet_str = packet.GetString();
+ std::string packet_str = std::string(packet.GetString());
return SendRawPacketNoLock(packet_str);
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 939cc2b..12b05e7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -573,7 +573,8 @@ StructuredData::ObjectSP GDBRemoteCommunicationClient::GetThreadsInfo() {
if (response.IsUnsupportedResponse()) {
m_supports_jThreadsInfo = false;
} else if (!response.Empty()) {
- object_sp = StructuredData::ParseJSON(response.GetStringRef());
+ object_sp =
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
}
}
}
@@ -685,7 +686,7 @@ GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses(
if (result != PacketResult::Success)
return result;
- const std::string &this_string = this_response.GetStringRef();
+ const std::string &this_string = std::string(this_response.GetStringRef());
// Check for m or l as first character; l seems to mean this is the last
// chunk
@@ -757,7 +758,7 @@ bool GDBRemoteCommunicationClient::GetLaunchSuccess(std::string &error_str) {
return true;
if (response.GetChar() == 'E') {
// A string the describes what failed when launching...
- error_str = response.GetStringRef().substr(1);
+ error_str = std::string(response.GetStringRef().substr(1));
} else {
error_str.assign("unknown error occurred launching process");
}
@@ -1000,7 +1001,7 @@ bool GDBRemoteCommunicationClient::GetGDBServerVersion() {
while (response.GetNameColonValue(name, value)) {
if (name.equals("name")) {
success = true;
- m_gdb_server_name = value;
+ m_gdb_server_name = std::string(value);
} else if (name.equals("version")) {
llvm::StringRef major, minor;
std::tie(major, minor) = value.split('.');
@@ -1158,7 +1159,7 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
if (!value.getAsInteger(0, sub))
++num_keys_decoded;
} else if (name.equals("arch")) {
- arch_name = value;
+ arch_name = std::string(value);
++num_keys_decoded;
} else if (name.equals("triple")) {
StringExtractor extractor(value);
@@ -1185,10 +1186,10 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
os_name = "ios";
environment = "macabi";
} else
- os_name = value;
+ os_name = std::string(value);
++num_keys_decoded;
} else if (name.equals("vendor")) {
- vendor_name = value;
+ vendor_name = std::string(value);
++num_keys_decoded;
} else if (name.equals("endian")) {
byte_order = llvm::StringSwitch<lldb::ByteOrder>(value)
@@ -1956,9 +1957,9 @@ bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse(
} else if (name.equals("cpusubtype")) {
value.getAsInteger(0, sub);
} else if (name.equals("vendor")) {
- vendor = value;
+ vendor = std::string(value);
} else if (name.equals("ostype")) {
- os_type = value;
+ os_type = std::string(value);
}
}
@@ -2049,10 +2050,10 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
os_name = "ios";
environment = "macabi";
} else
- os_name = value;
+ os_name = std::string(value);
++num_keys_decoded;
} else if (name.equals("vendor")) {
- vendor_name = value;
+ vendor_name = std::string(value);
++num_keys_decoded;
} else if (name.equals("endian")) {
byte_order = llvm::StringSwitch<lldb::ByteOrder>(value)
@@ -2069,7 +2070,7 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
if (!value.getAsInteger(16, pid))
++num_keys_decoded;
} else if (name.equals("elf_abi")) {
- elf_abi = value;
+ elf_abi = std::string(value);
++num_keys_decoded;
}
}
@@ -2536,7 +2537,7 @@ size_t GDBRemoteCommunicationClient::QueryGDBServer(
return 0;
StructuredData::ObjectSP data =
- StructuredData::ParseJSON(response.GetStringRef());
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
if (!data)
return 0;
@@ -2557,7 +2558,7 @@ size_t GDBRemoteCommunicationClient::QueryGDBServer(
std::string socket_name;
if (StructuredData::ObjectSP socket_name_osp =
element->GetValueForKey(llvm::StringRef("socket_name")))
- socket_name = socket_name_osp->GetStringValue();
+ socket_name = std::string(socket_name_osp->GetStringValue());
if (port != 0 || !socket_name.empty())
connection_urls.emplace_back(port, socket_name);
@@ -3667,7 +3668,7 @@ GDBRemoteCommunicationClient::GetModulesInfo(
}
StructuredData::ObjectSP response_object_sp =
- StructuredData::ParseJSON(response.GetStringRef());
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
if (!response_object_sp)
return llvm::None;
@@ -3722,7 +3723,7 @@ bool GDBRemoteCommunicationClient::ReadExtFeature(
return false;
}
- const std::string &str = chunk.GetStringRef();
+ const std::string &str = std::string(chunk.GetStringRef());
if (str.length() == 0) {
// should have some data in chunk
err.SetErrorString("Empty response from $qXfer packet");
@@ -3936,7 +3937,7 @@ GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins() {
if (SendPacketAndWaitForResponse("qStructuredDataPlugins", response,
send_async) == PacketResult::Success) {
m_supported_async_json_packets_sp =
- StructuredData::ParseJSON(response.GetStringRef());
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
if (m_supported_async_json_packets_sp &&
!m_supported_async_json_packets_sp->GetAsArray()) {
// We were returned something other than a JSON array. This is
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 52bc85a..cac2674 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -1237,7 +1237,7 @@ void GDBRemoteCommunicationServerCommon::
response.PutStringAsRawHex8(proc_triple.getTriple());
response.PutChar(';');
#endif
- std::string ostype = proc_triple.getOSName();
+ std::string ostype = std::string(proc_triple.getOSName());
// Adjust so ostype reports ios for Apple/ARM and Apple/ARM64.
if (proc_triple.getVendor() == llvm::Triple::Apple) {
switch (proc_triple.getArch()) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index bd9e4d1..d14b79a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -173,7 +173,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
uint16_t port = UINT16_MAX;
while (packet.GetNameColonValue(name, value)) {
if (name.equals("host"))
- hostname = value;
+ hostname = std::string(value);
else if (name.equals("port"))
value.getAsInteger(0, port);
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3624e3b..b715d5e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -359,7 +359,8 @@ bool ProcessGDBRemote::ParsePythonTargetDefinition(
StructuredData::ObjectSP triple_value =
host_info_dict->GetValueForKey("triple");
if (auto triple_string_value = triple_value->GetAsString()) {
- std::string triple_string = triple_string_value->GetValue();
+ std::string triple_string =
+ std::string(triple_string_value->GetValue());
ArchSpec host_arch(triple_string.c_str());
if (!host_arch.IsCompatibleMatch(GetTarget().GetArchitecture())) {
GetTarget().SetArchitecture(host_arch);
@@ -1576,7 +1577,8 @@ bool ProcessGDBRemote::UpdateThreadIDList() {
for (int i = 0; i < nItems; i++) {
// Get the thread stop info
StringExtractorGDBRemote &stop_info = m_stop_packet_stack[i];
- const std::string &stop_info_str = stop_info.GetStringRef();
+ const std::string &stop_info_str =
+ std::string(stop_info.GetStringRef());
m_thread_pcs.clear();
const size_t thread_pcs_pos = stop_info_str.find(";thread-pcs:");
@@ -2040,14 +2042,14 @@ ProcessGDBRemote::SetThreadStopInfo(StructuredData::Dictionary *thread_dict) {
});
}
} else if (key == g_key_name) {
- thread_name = object->GetStringValue();
+ thread_name = std::string(object->GetStringValue());
} else if (key == g_key_qaddr) {
thread_dispatch_qaddr = object->GetIntegerValue(LLDB_INVALID_ADDRESS);
} else if (key == g_key_queue_name) {
queue_vars_valid = true;
- queue_name = object->GetStringValue();
+ queue_name = std::string(object->GetStringValue());
} else if (key == g_key_queue_kind) {
- std::string queue_kind_str = object->GetStringValue();
+ std::string queue_kind_str = std::string(object->GetStringValue());
if (queue_kind_str == "serial") {
queue_vars_valid = true;
queue_kind = eQueueKindSerial;
@@ -2071,9 +2073,9 @@ ProcessGDBRemote::SetThreadStopInfo(StructuredData::Dictionary *thread_dict) {
else
associated_with_dispatch_queue = eLazyBoolNo;
} else if (key == g_key_reason) {
- reason = object->GetStringValue();
+ reason = std::string(object->GetStringValue());
} else if (key == g_key_description) {
- description = object->GetStringValue();
+ description = std::string(object->GetStringValue());
} else if (key == g_key_registers) {
StructuredData::Dictionary *registers_dict = object->GetAsDictionary();
@@ -2084,7 +2086,8 @@ ProcessGDBRemote::SetThreadStopInfo(StructuredData::Dictionary *thread_dict) {
const uint32_t reg =
StringConvert::ToUInt32(key.GetCString(), UINT32_MAX, 10);
if (reg != UINT32_MAX)
- expedited_register_map[reg] = object->GetStringValue();
+ expedited_register_map[reg] =
+ std::string(object->GetStringValue());
return true; // Keep iterating through all array items
});
}
@@ -2227,7 +2230,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
// Now convert the HEX bytes into a string value
name_extractor.GetHexByteString(thread_name);
} else if (key.compare("name") == 0) {
- thread_name = value;
+ thread_name = std::string(value);
} else if (key.compare("qaddr") == 0) {
value.getAsInteger(16, thread_dispatch_qaddr);
} else if (key.compare("dispatch_queue_t") == 0) {
@@ -2248,7 +2251,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
if (!value.getAsInteger(0, queue_serial_number))
queue_vars_valid = true;
} else if (key.compare("reason") == 0) {
- reason = value;
+ reason = std::string(value);
} else if (key.compare("description") == 0) {
StringExtractor desc_extractor(value);
// Now convert the HEX bytes into a string value
@@ -2297,7 +2300,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
reason = "watchpoint";
StreamString ostr;
ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
- description = ostr.GetString();
+ description = std::string(ostr.GetString());
} else if (key.compare("library") == 0) {
auto error = LoadModules();
if (error) {
@@ -2308,7 +2311,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
} else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
uint32_t reg = UINT32_MAX;
if (!key.getAsInteger(16, reg))
- expedited_register_map[reg] = std::move(value);
+ expedited_register_map[reg] = std::string(std::move(value));
}
}
@@ -2585,7 +2588,7 @@ Status ProcessGDBRemote::DoDestroy() {
"to k packet: %s",
response.GetStringRef().data());
exit_string.assign("got unexpected response to k packet: ");
- exit_string.append(response.GetStringRef());
+ exit_string.append(std::string(response.GetStringRef()));
}
} else {
LLDB_LOGF(log, "ProcessGDBRemote::DoDestroy - failed to send k packet");
@@ -3648,7 +3651,7 @@ void ProcessGDBRemote::StopAsyncThread() {
bool ProcessGDBRemote::HandleNotifyPacket(StringExtractorGDBRemote &packet) {
// get the packet at a string
- const std::string &pkt = packet.GetStringRef();
+ const std::string &pkt = std::string(packet.GetStringRef());
// skip %stop:
StringExtractorGDBRemote stop_info(pkt.c_str() + 5);
@@ -4030,7 +4033,8 @@ ProcessGDBRemote::GetExtendedInfoForThread(lldb::tid_t tid) {
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp = StructuredData::ParseJSON(response.GetStringRef());
+ object_sp =
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
}
}
}
@@ -4102,7 +4106,8 @@ ProcessGDBRemote::GetLoadedDynamicLibrariesInfos_sender(
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp = StructuredData::ParseJSON(response.GetStringRef());
+ object_sp =
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
}
}
}
@@ -4135,7 +4140,8 @@ StructuredData::ObjectSP ProcessGDBRemote::GetSharedCacheInfo() {
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp = StructuredData::ParseJSON(response.GetStringRef());
+ object_sp =
+ StructuredData::ParseJSON(std::string(response.GetStringRef()));
}
}
}
@@ -5069,7 +5075,8 @@ ParseStructuredDataPacket(llvm::StringRef packet) {
}
// This is an asynchronous JSON packet, destined for a StructuredDataPlugin.
- StructuredData::ObjectSP json_sp = StructuredData::ParseJSON(packet);
+ StructuredData::ObjectSP json_sp =
+ StructuredData::ParseJSON(std::string(packet));
if (log) {
if (json_sp) {
StreamString json_str;
@@ -5276,7 +5283,7 @@ public:
result.SetStatus(eReturnStatusSuccessFinishResult);
Stream &output_strm = result.GetOutputStream();
output_strm.Printf(" packet: %s\n", packet_cstr);
- std::string response_str = response.GetStringRef();
+ std::string response_str = std::string(response.GetStringRef());
if (strstr(packet_cstr, "qGetProfileData") != nullptr) {
response_str = process->HarmonizeThreadIdsForProfileData(response);
@@ -5329,7 +5336,7 @@ public:
[&output_strm](llvm::StringRef output) { output_strm << output; });
result.SetStatus(eReturnStatusSuccessFinishResult);
output_strm.Printf(" packet: %s\n", packet.GetData());
- const std::string &response_str = response.GetStringRef();
+ const std::string &response_str = std::string(response.GetStringRef());
if (response_str.empty())
output_strm.PutCString("response: \nerror: UNIMPLEMENTED\n");
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index b75045b..2bab326 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -595,7 +595,7 @@ public:
// safe, returns invalid on error;
static PythonModule ImportModule(llvm::StringRef name) {
- std::string s = name;
+ std::string s = std::string(name);
auto mod = Import(s.c_str());
if (!mod) {
llvm::consumeError(mod.takeError());
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index ce4fb30..95a686d 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -853,7 +853,7 @@ static std::string GenerateUniqueName(const char *base_name_wanted,
else
sstr.Printf("%s_%p", base_name_wanted, name_token);
- return sstr.GetString();
+ return std::string(sstr.GetString());
}
bool ScriptInterpreterPythonImpl::GetEmbeddedInterpreterModuleObjects() {
@@ -3035,7 +3035,7 @@ bool ScriptInterpreterPythonImpl::GetDocumentationForItem(const char *item,
StreamString str_stream;
str_stream.Printf(
"Function %s was not found. Containing module might be missing.", item);
- dest = str_stream.GetString();
+ dest = std::string(str_stream.GetString());
return false;
}
}
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index a3d1144..ad75bcc 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -706,9 +706,9 @@ private:
attribute_end_pos + 1, operation_end_pos - (attribute_end_pos + 1));
// add filter spec
- auto rule_sp =
- FilterRule::CreateRule(accept, attribute_index, ConstString(operation),
- rule_text.substr(operation_end_pos + 1), error);
+ auto rule_sp = FilterRule::CreateRule(
+ accept, attribute_index, ConstString(operation),
+ std::string(rule_text.substr(operation_end_pos + 1)), error);
if (rule_sp && error.Success())
m_filter_rules.push_back(rule_sp);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
index 8b1a573..f25dc84 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
@@ -154,7 +154,7 @@ CompilandIndexItem &CompileUnitIndex::GetOrCreateCompiland(uint16_t modi) {
// name until we find it, and we can cache that one since the memory is backed
// by a contiguous chunk inside the mapped PDB.
llvm::SmallString<64> main_file = GetMainSourceFile(*cci);
- std::string s = main_file.str();
+ std::string s = std::string(main_file.str());
llvm::sys::path::native(main_file);
uint32_t file_count = modules.getSourceFileCount(modi);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index f80d45b..d06d542 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -178,7 +178,7 @@ GetNestedTagDefinition(const NestedTypeRecord &Record,
// single component of a mangled name. So we can inject it into the parent's
// mangled name to see if it matches.
CVTagRecord child = CVTagRecord::create(cvt);
- std::string qname = parent.asTag().getUniqueName();
+ std::string qname = std::string(parent.asTag().getUniqueName());
if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4)
return llvm::None;
@@ -221,7 +221,7 @@ PdbAstBuilder::CreateDeclInfoForType(const TagRecord &record, TypeIndex ti) {
StringView sv(record.UniqueName.begin(), record.UniqueName.size());
llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
if (demangler.Error)
- return {m_clang.GetTranslationUnitDecl(), record.UniqueName};
+ return {m_clang.GetTranslationUnitDecl(), std::string(record.UniqueName)};
llvm::ms_demangle::IdentifierNode *idn =
ttn->QualifiedName->getUnqualifiedIdentifier();
@@ -248,7 +248,7 @@ PdbAstBuilder::CreateDeclInfoForType(const TagRecord &record, TypeIndex ti) {
// a NamespaceDecl and a CXXRecordDecl, so instead we create a class at
// global scope with the fully qualified name.
if (AnyScopesHaveTemplateParams(scopes))
- return {context, record.Name};
+ return {context, std::string(record.Name)};
for (llvm::ms_demangle::Node *scope : scopes) {
auto *nii = static_cast<llvm::ms_demangle::NamedIdentifierNode *>(scope);
@@ -507,7 +507,7 @@ PdbAstBuilder::CreateDeclInfoForUndecoratedName(llvm::StringRef name) {
llvm::StringRef uname = specs.back().GetBaseName();
specs = specs.drop_back();
if (specs.empty())
- return {context, name};
+ return {context, std::string(name)};
llvm::StringRef scope_name = specs.back().GetFullName();
@@ -517,7 +517,7 @@ PdbAstBuilder::CreateDeclInfoForUndecoratedName(llvm::StringRef name) {
clang::QualType qt = GetOrCreateType(types.back());
clang::TagDecl *tag = qt->getAsTagDecl();
if (tag)
- return {clang::TagDecl::castToDeclContext(tag), uname};
+ return {clang::TagDecl::castToDeclContext(tag), std::string(uname)};
types.pop_back();
}
@@ -526,7 +526,7 @@ PdbAstBuilder::CreateDeclInfoForUndecoratedName(llvm::StringRef name) {
std::string ns_name = spec.GetBaseName().str();
context = GetOrCreateNamespaceDecl(ns_name.c_str(), *context);
}
- return {context, uname};
+ return {context, std::string(uname)};
}
clang::DeclContext *
@@ -876,7 +876,7 @@ PdbAstBuilder::GetOrCreateTypedefDecl(PdbGlobalSymId id) {
PdbTypeSymId real_type_id{udt.Type, false};
clang::QualType qt = GetOrCreateType(real_type_id);
- std::string uname = DropNameScope(udt.Name);
+ std::string uname = std::string(DropNameScope(udt.Name));
CompilerType ct = m_clang.CreateTypedefType(ToCompilerType(qt), uname.c_str(),
ToCompilerDeclContext(*scope));
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 9ecaa04..85ce87e 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -139,7 +139,7 @@ loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
ec = llvm::identify_magic(pdb_file, magic);
if (ec || magic != llvm::file_magic::pdb)
return nullptr;
- std::unique_ptr<PDBFile> pdb = loadPDBFile(pdb_file, allocator);
+ std::unique_ptr<PDBFile> pdb = loadPDBFile(std::string(pdb_file), allocator);
if (!pdb)
return nullptr;
@@ -452,7 +452,7 @@ lldb::TypeSP SymbolFileNativePDB::CreateModifierType(PdbTypeSymId type_id,
std::string name;
if (mr.ModifiedType.isSimple())
- name = GetSimpleTypeName(mr.ModifiedType.getSimpleKind());
+ name = std::string(GetSimpleTypeName(mr.ModifiedType.getSimpleKind()));
else
name = computeTypeName(stream.typeCollection(), mr.ModifiedType);
Declaration decl;
@@ -532,14 +532,14 @@ static std::string GetUnqualifiedTypeName(const TagRecord &record) {
MSVCUndecoratedNameParser parser(record.Name);
llvm::ArrayRef<MSVCUndecoratedNameSpecifier> specs = parser.GetSpecifiers();
- return specs.back().GetBaseName();
+ return std::string(specs.back().GetBaseName());
}
llvm::ms_demangle::Demangler demangler;
StringView sv(record.UniqueName.begin(), record.UniqueName.size());
llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
if (demangler.Error)
- return record.Name;
+ return std::string(record.Name);
llvm::ms_demangle::IdentifierNode *idn =
ttn->QualifiedName->getUnqualifiedIdentifier();
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 593e156..010a9ea 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -386,7 +386,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
return nullptr;
// Ignore unnamed-tag UDTs.
- std::string name = MSVCUndecoratedNameParser::DropScope(udt->getName());
+ std::string name =
+ std::string(MSVCUndecoratedNameParser::DropScope(udt->getName()));
if (name.empty())
return nullptr;
@@ -465,7 +466,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
assert(enum_type);
std::string name =
- MSVCUndecoratedNameParser::DropScope(enum_type->getName());
+ std::string(MSVCUndecoratedNameParser::DropScope(enum_type->getName()));
auto decl_context = GetDeclContextContainingSymbol(type);
uint64_t bytes = enum_type->getLength();
@@ -538,7 +539,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
return nullptr;
std::string name =
- MSVCUndecoratedNameParser::DropScope(type_def->getName());
+ std::string(MSVCUndecoratedNameParser::DropScope(type_def->getName()));
auto decl_ctx = GetDeclContextContainingSymbol(type);
// Check if such a typedef already exists in the current context
@@ -587,7 +588,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
return nullptr;
func_sig = sig.release();
// Function type is named.
- name = MSVCUndecoratedNameParser::DropScope(pdb_func->getName());
+ name = std::string(
+ MSVCUndecoratedNameParser::DropScope(pdb_func->getName()));
} else if (auto pdb_func_sig =
llvm::dyn_cast<PDBSymbolTypeFunctionSig>(&type)) {
func_sig = const_cast<PDBSymbolTypeFunctionSig *>(pdb_func_sig);
@@ -887,7 +889,8 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
if (auto parent_decl = llvm::dyn_cast_or_null<clang::TagDecl>(decl_context))
m_ast.GetCompleteDecl(parent_decl);
- std::string name = MSVCUndecoratedNameParser::DropScope(data->getName());
+ std::string name =
+ std::string(MSVCUndecoratedNameParser::DropScope(data->getName()));
// Check if the current context already contains the symbol with the name.
clang::Decl *decl =
@@ -913,7 +916,8 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
auto decl_context = GetDeclContextContainingSymbol(symbol);
assert(decl_context);
- std::string name = MSVCUndecoratedNameParser::DropScope(func->getName());
+ std::string name =
+ std::string(MSVCUndecoratedNameParser::DropScope(func->getName()));
Type *type = symbol_file->ResolveTypeUID(sym_id);
if (!type)
@@ -1047,7 +1051,7 @@ clang::DeclContext *PDBASTParser::GetDeclContextContainingSymbol(
// or a type. We check it to avoid fake namespaces such as `__l2':
// `N0::N1::CClass::PrivateFunc::__l2::InnerFuncStruct'
if (!has_type_or_function_parent) {
- std::string namespace_name = specs[i].GetBaseName();
+ std::string namespace_name = std::string(specs[i].GetBaseName());
const char *namespace_name_c_str =
IsAnonymousNamespaceName(namespace_name) ? nullptr
: namespace_name.data();
@@ -1119,7 +1123,8 @@ bool PDBASTParser::AddEnumValue(CompilerType enum_type,
const PDBSymbolData &enum_value) {
Declaration decl;
Variant v = enum_value.getValue();
- std::string name = MSVCUndecoratedNameParser::DropScope(enum_value.getName());
+ std::string name =
+ std::string(MSVCUndecoratedNameParser::DropScope(enum_value.getName()));
int64_t raw_value;
switch (v.Type) {
case PDB_VariantType::Int8:
@@ -1333,7 +1338,8 @@ clang::CXXMethodDecl *
PDBASTParser::AddRecordMethod(lldb_private::SymbolFile &symbol_file,
lldb_private::CompilerType &record_type,
const llvm::pdb::PDBSymbolFunc &method) const {
- std::string name = MSVCUndecoratedNameParser::DropScope(method.getName());
+ std::string name =
+ std::string(MSVCUndecoratedNameParser::DropScope(method.getName()));
Type *method_type = symbol_file.ResolveTypeUID(method.getSymIndexId());
// MSVC specific __vecDelDtor.
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index c2e356e..11cfb3c 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -199,9 +199,9 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
DBGSourcePath;
if (plist_sp->GetAsDictionary()->HasKey("DBGVersion")) {
std::string version_string =
- plist_sp->GetAsDictionary()
- ->GetValueForKey("DBGVersion")
- ->GetStringValue("");
+ std::string(plist_sp->GetAsDictionary()
+ ->GetValueForKey("DBGVersion")
+ ->GetStringValue(""));
if (!version_string.empty() &&
isdigit(version_string[0])) {
int version_number = atoi(version_string.c_str());
@@ -228,7 +228,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
// key is DBGBuildSourcePath
// object is DBGSourcePath
std::string DBGSourcePath =
- object->GetStringValue();
+ std::string(object->GetStringValue());
if (!new_style_source_remapping_dictionary &&
!original_DBGSourcePath_value.empty()) {
DBGSourcePath = original_DBGSourcePath_value;