diff options
Diffstat (limited to 'lldb/source/Plugins')
30 files changed, 73 insertions, 86 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index 2f6e7e46d0f..9d4f34fa82c 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -736,7 +736,7 @@ public: if (op.m_negative) { s.PutCString("-"); } - s.PutCString(llvm::to_string(op.m_immediate).c_str()); + s.PutCString(llvm::to_string(op.m_immediate)); break; case Operand::Type::Invalid: s.PutCString("Invalid"); @@ -1044,8 +1044,7 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch, } else { thumb_arch_name = "thumbv8.2a"; } - thumb_arch.GetTriple().setArchName( - llvm::StringRef(thumb_arch_name.c_str())); + thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name)); } // If no sub architecture specified then use the most recent arm architecture diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 1093ff5a578..fcbba93762f 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -369,7 +369,7 @@ void DynamicLoaderHexagonDYLD::RefreshModules() { E = m_rendezvous.loaded_end(); for (I = m_rendezvous.loaded_begin(); I != E; ++I) { - FileSpec file(I->path.c_str(), true); + FileSpec file(I->path, true); ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { @@ -393,7 +393,7 @@ void DynamicLoaderHexagonDYLD::RefreshModules() { E = m_rendezvous.unloaded_end(); for (I = m_rendezvous.unloaded_begin(); I != E; ++I) { - FileSpec file(I->path.c_str(), true); + FileSpec file(I->path, true); ModuleSpec module_spec(file); ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index e7c07d29ba9..bf2549b4e5c 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -378,8 +378,7 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( image_infos[i].mod_date = image->GetValueForKey("mod_date")->GetAsInteger()->GetValue(); image_infos[i].file_spec.SetFile( - image->GetValueForKey("pathname")->GetAsString()->GetValue().c_str(), - false); + image->GetValueForKey("pathname")->GetAsString()->GetValue(), false); StructuredData::Dictionary *mh = image->GetValueForKey("mach_header")->GetAsDictionary(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 70961c0e8e5..7b027de783e 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -472,9 +472,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() - .c_str(); + std::string uuid_str = + info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue(); if (!uuid_str.empty()) uuid.SetFromCString(uuid_str.c_str()); if (info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() == diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp index 3c20b516c10..c74f1474e7b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp @@ -106,6 +106,4 @@ void ASTDumper::ToLog(Log *log, const char *prefix) { free(alloc); } -void ASTDumper::ToStream(lldb::StreamSP &stream) { - stream->PutCString(m_dump.c_str()); -} +void ASTDumper::ToStream(lldb::StreamSP &stream) { stream->PutCString(m_dump); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp index 4081bc990c9..7bb784e8f9a 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp @@ -60,7 +60,7 @@ void ASTStructExtractor::ExtractFromFunctionDecl(FunctionDecl *F) { RecordDecl *struct_decl = NULL; - StringRef desired_name(m_struct_name.c_str()); + StringRef desired_name(m_struct_name); for (CompoundStmt::const_body_iterator bi = body_compound_stmt->body_begin(), be = body_compound_stmt->body_end(); @@ -125,7 +125,7 @@ void ASTStructExtractor::ExtractFromTopLevelDecl(Decl *D) { if (m_ast_context && function_decl && !m_function.m_wrapper_function_name.compare( - function_decl->getNameAsString().c_str())) { + function_decl->getNameAsString())) { ExtractFromFunctionDecl(function_decl); } } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 7a5f4f7a192..b55d6644845 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -922,7 +922,7 @@ static bool FindObjCMethodDeclsWithOrigin( std::string decl_name_string_without_colon(decl_name_string.c_str(), decl_name_string.length() - 1); IdentifierInfo *ident = - &original_ctx->Idents.get(decl_name_string_without_colon.c_str()); + &original_ctx->Idents.get(decl_name_string_without_colon); original_selector = original_ctx->Selectors.getSelector(1, &ident); } else { SmallVector<IdentifierInfo *, 4> idents; @@ -1293,7 +1293,7 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin( return false; std::string name_str = context.m_decl_name.getAsString(); - StringRef name(name_str.c_str()); + StringRef name(name_str); IdentifierInfo &name_identifier( origin_iface_decl->getASTContext().Idents.get(name)); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 3c21de241c4..c542b36b674 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -131,7 +131,7 @@ void StoringDiagnosticConsumer::DumpDiagnostics(Stream &error_stream) { for (IDAndDiagnostic &diag : m_diagnostics) { switch (diag.first) { default: - error_stream.PutCString(diag.second.c_str()); + error_stream.PutCString(diag.second); error_stream.PutChar('\n'); break; case clang::DiagnosticsEngine::Level::Ignored: @@ -441,7 +441,7 @@ void ClangModulesDeclVendorImpl::ForEachMacro( if (macro_info) { std::string macro_expansion = "#define "; - macro_expansion.append(mi->first->getName().str().c_str()); + macro_expansion.append(mi->first->getName().str()); { if (macro_info->isFunctionLike()) { diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 0956814cab8..ac6e93ce660 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1149,7 +1149,7 @@ bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) { GlobalVariable *persistent_global = new GlobalVariable( (*m_module), alloc->getType(), false, /* not constant */ GlobalValue::ExternalLinkage, NULL, /* no initializer */ - alloc->getName().str().c_str()); + alloc->getName().str()); // What we're going to do here is make believe this was a regular old external // variable. That means we need to make the metadata valid. diff --git a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp index 45c26e85edc..4216c5a3b87 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp @@ -244,7 +244,7 @@ bool AddressSanitizerRuntime::NotifyBreakpointHit( if (thread_sp) thread_sp->SetStopInfo(InstrumentationRuntimeStopInfo:: CreateStopReasonWithInstrumentationData( - *thread_sp, description.c_str(), report)); + *thread_sp, description, report)); StreamFileSP stream_sp( process_sp->GetTarget().GetDebugger().GetOutputFile()); diff --git a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp index c78836a8064..84c8b6443f7 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp @@ -817,7 +817,7 @@ bool ThreadSanitizerRuntime::NotifyBreakpointHit( thread_sp->SetStopInfo( InstrumentationRuntimeStopInfo:: CreateStopReasonWithInstrumentationData( - *thread_sp, stop_reason_description.c_str(), report)); + *thread_sp, stop_reason_description, report)); StreamFileSP stream_sp( process_sp->GetTarget().GetDebugger().GetOutputFile()); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index b20c4f91074..406fa501735 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -972,7 +972,7 @@ lldb_private::FileSpecList ObjectFileELF::GetDebugSymbolFilePaths() { FileSpecList file_spec_list; if (!m_gnu_debuglink_file.empty()) { - FileSpec file_spec(m_gnu_debuglink_file.c_str(), false); + FileSpec file_spec(m_gnu_debuglink_file, false); file_spec_list.Append(file_spec); } return file_spec_list; diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp index 2578b9a2da5..79ad8f52d64 100644 --- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp +++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp @@ -428,7 +428,7 @@ AdbClient::GetSyncService(Error &error) { Error AdbClient::SyncService::internalPullFile(const FileSpec &remote_file, const FileSpec &local_file) { const auto local_file_path = local_file.GetPath(); - llvm::FileRemover local_file_remover(local_file_path.c_str()); + llvm::FileRemover local_file_remover(local_file_path); std::ofstream dst(local_file_path, std::ios::out | std::ios::binary); if (!dst.is_open()) diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 364bd9106b4..9f1a38924fd 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -345,7 +345,7 @@ Error PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, log->Printf("Failed to remove temp directory: %s", error.AsCString()); }); - FileSpec symfile_platform_filespec(tmpdir.c_str(), false); + FileSpec symfile_platform_filespec(tmpdir, false); symfile_platform_filespec.AppendPathComponent("symbolized.oat"); // Execute oatdump on the remote device to generate a file with symtab diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index b47fc771ee8..a92a8da50fb 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -373,7 +373,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( if (!cache_path.empty()) { std::string module_path(module_spec.GetFileSpec().GetPath()); cache_path.append(module_path); - FileSpec module_cache_spec(cache_path.c_str(), false); + FileSpec module_cache_spec(cache_path, false); // if rsync is supported, always bring in the file - rsync will be very // efficient @@ -1294,7 +1294,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() { if (xcode_select_prefix_dir) xcode_dir_path.append(xcode_select_prefix_dir); xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path"); - temp_file_spec.SetFile(xcode_dir_path.c_str(), false); + temp_file_spec.SetFile(xcode_dir_path, false); size_t bytes_read = temp_file_spec.ReadFileContents( 0, developer_dir_path, sizeof(developer_dir_path), NULL); if (bytes_read > 0) { @@ -1436,7 +1436,7 @@ static FileSpec CheckPathForXcode(const FileSpec &fspec) { size_t pos = path_to_shlib.rfind(substr); if (pos != std::string::npos) { path_to_shlib.erase(pos + strlen(substr)); - FileSpec ret(path_to_shlib.c_str(), false); + FileSpec ret(path_to_shlib, false); FileSpec xcode_binary_path = ret; xcode_binary_path.AppendPathComponent("MacOS"); @@ -1503,7 +1503,7 @@ static FileSpec GetXcodeContentsPath() { } output.append("/.."); - g_xcode_filespec = CheckPathForXcode(FileSpec(output.c_str(), false)); + g_xcode_filespec = CheckPathForXcode(FileSpec(output, false)); } } } @@ -1604,7 +1604,7 @@ FileSpec PlatformDarwin::FindSDKInXcodeForModules(SDKType sdk_type, enumerator_info.sdk_type = sdk_type; - FileSpec::EnumerateDirectory(sdks_spec.GetPath().c_str(), find_directories, + FileSpec::EnumerateDirectory(sdks_spec.GetPath(), find_directories, find_files, find_other, DirectoryEnumerator, &enumerator_info); @@ -1654,8 +1654,7 @@ FileSpec PlatformDarwin::GetSDKDirectoryForModules(SDKType sdk_type) { FileSpec native_sdk_spec = sdks_spec; StreamString native_sdk_name; native_sdk_name.Printf("MacOSX%u.%u.sdk", major, minor); - native_sdk_spec.AppendPathComponent( - native_sdk_name.GetString().c_str()); + native_sdk_spec.AppendPathComponent(native_sdk_name.GetString()); if (native_sdk_spec.Exists()) { return native_sdk_spec; @@ -1744,22 +1743,19 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( minimum_version_option.PutCString("-mios-version-min="); minimum_version_option.PutCString( clang::VersionTuple(versions[0], versions[1], versions[2]) - .getAsString() - .c_str()); + .getAsString()); break; case SDKType::iPhoneSimulator: minimum_version_option.PutCString("-mios-simulator-version-min="); minimum_version_option.PutCString( clang::VersionTuple(versions[0], versions[1], versions[2]) - .getAsString() - .c_str()); + .getAsString()); break; case SDKType::MacOSX: minimum_version_option.PutCString("-mmacosx-version-min="); minimum_version_option.PutCString( clang::VersionTuple(versions[0], versions[1], versions[2]) - .getAsString() - .c_str()); + .getAsString()); } options.push_back(minimum_version_option.GetString()); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 87a546b044a..89b61bf281b 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -220,13 +220,13 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) { "SDKs/MacOSX%u.%u.sdk", xcode_contents_path.c_str(), versions[0], versions[1]); - fspec.SetFile(sdk_path.GetString().c_str(), false); + fspec.SetFile(sdk_path.GetString(), false); if (fspec.Exists()) return ConstString(sdk_path.GetString().c_str()); } if (!default_xcode_sdk.empty()) { - fspec.SetFile(default_xcode_sdk.c_str(), false); + fspec.SetFile(default_xcode_sdk, false); if (fspec.Exists()) return ConstString(default_xcode_sdk.c_str()); } @@ -270,7 +270,7 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file, std::string cache_path(GetLocalCacheDirectory()); std::string module_path(platform_file.GetPath()); cache_path.append(module_path); - FileSpec module_cache_spec(cache_path.c_str(), false); + FileSpec module_cache_spec(cache_path, false); if (module_cache_spec.Exists()) { local_file = module_cache_spec; return Error(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index fef09f0519a..d62412f79cb 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -271,8 +271,8 @@ bool PlatformRemoteAppleTV::UpdateSDKDirectoryInfosIfNeeded() { const bool find_other = false; SDKDirectoryInfoCollection builtin_sdk_directory_infos; - FileSpec::EnumerateDirectory(m_device_support_directory.c_str(), - find_directories, find_files, find_other, + FileSpec::EnumerateDirectory(m_device_support_directory, find_directories, + find_files, find_other, GetContainedFilesIntoVectorOfStringsCallback, &builtin_sdk_directory_infos); @@ -530,7 +530,7 @@ bool PlatformRemoteAppleTV::GetFileInSDK(const char *platform_file_path, const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr}; for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - local_file.SetFile(sdkroot_path.c_str(), false); + local_file.SetFile(sdkroot_path, false); if (paths_to_try[i][0] != '\0') local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index b815e4fb9fc..b64aa62591f 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -281,8 +281,8 @@ bool PlatformRemoteAppleWatch::UpdateSDKDirectoryInfosIfNeeded() { const bool find_other = false; SDKDirectoryInfoCollection builtin_sdk_directory_infos; - FileSpec::EnumerateDirectory(m_device_support_directory.c_str(), - find_directories, find_files, find_other, + FileSpec::EnumerateDirectory(m_device_support_directory, find_directories, + find_files, find_other, GetContainedFilesIntoVectorOfStringsCallback, &builtin_sdk_directory_infos); @@ -452,14 +452,13 @@ const char *PlatformRemoteAppleWatch::GetDeviceSupportDirectory() { m_device_support_directory.assign(device_support_dir); m_device_support_directory.append( "/Platforms/watchOS.platform/DeviceSupport"); - FileSpec platform_device_support_dir(m_device_support_directory.c_str(), - true); + FileSpec platform_device_support_dir(m_device_support_directory, true); if (!platform_device_support_dir.Exists()) { std::string alt_platform_dirname = device_support_dir; alt_platform_dirname.append( "/Platforms/WatchOS.platform/DeviceSupport"); - FileSpec alt_platform_device_support_dir( - m_device_support_directory.c_str(), true); + FileSpec alt_platform_device_support_dir(m_device_support_directory, + true); if (alt_platform_device_support_dir.Exists()) { m_device_support_directory = alt_platform_dirname; } @@ -545,7 +544,7 @@ bool PlatformRemoteAppleWatch::GetFileInSDK( const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr}; for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - local_file.SetFile(sdkroot_path.c_str(), false); + local_file.SetFile(sdkroot_path, false); if (paths_to_try[i][0] != '\0') local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 6abd6e93104..0553b1b0e3a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -288,8 +288,8 @@ bool PlatformRemoteiOS::UpdateSDKDirectoryInfosIfNeeded() { const bool find_other = false; SDKDirectoryInfoCollection builtin_sdk_directory_infos; - FileSpec::EnumerateDirectory(m_device_support_directory.c_str(), - find_directories, find_files, find_other, + FileSpec::EnumerateDirectory(m_device_support_directory, find_directories, + find_files, find_other, GetContainedFilesIntoVectorOfStringsCallback, &builtin_sdk_directory_infos); @@ -516,7 +516,7 @@ bool PlatformRemoteiOS::GetFileInSDK(const char *platform_file_path, const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr}; for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - local_file.SetFile(sdkroot_path.c_str(), false); + local_file.SetFile(sdkroot_path, false); if (paths_to_try[i][0] != '\0') local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 8e2587bce0e..8494077141b 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2475,7 +2475,7 @@ Error NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path, if (columns.size() < 6) return true; // continue searching - FileSpec this_file_spec(columns[5].str().c_str(), false); + FileSpec this_file_spec(columns[5].str(), false); if (this_file_spec.GetFilename() != module_file_spec.GetFilename()) return true; // continue searching diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 06b1b36cd59..601942808c5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -880,8 +880,8 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len, } } - m_history.AddPacket(m_bytes.c_str(), total_length, - History::ePacketTypeRecv, total_length); + m_history.AddPacket(m_bytes, total_length, History::ePacketTypeRecv, + total_length); // Clear packet_str in case there is some existing data in it. packet_str.clear(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 600bd9ca939..da629089a6c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -345,7 +345,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { packet.PutCString("qSupported"); for (uint32_t i = 0; i < features.size(); ++i) { packet.PutCString(i == 0 ? ":" : ";"); - packet.PutCString(features[i].c_str()); + packet.PutCString(features[i]); } StringExtractorGDBRemote response; @@ -1070,7 +1070,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( if (avail_type != CompressionType::None) { StringExtractorGDBRemote response; std::string packet = "QEnableCompression:type:" + avail_name + ";"; - if (SendPacketAndWaitForResponse(packet.c_str(), response, false) != + if (SendPacketAndWaitForResponse(packet, response, false) != PacketResult::Success) return; @@ -1772,7 +1772,7 @@ bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse( // control the characters in a process name std::string name; extractor.GetHexByteString(name); - process_info.GetExecutableFile().SetFile(name.c_str(), false); + process_info.GetExecutableFile().SetFile(name, false); } else if (name.equals("cputype")) { value.getAsInteger(0, cpu); } else if (name.equals("cpusubtype")) { @@ -2015,7 +2015,7 @@ uint32_t GDBRemoteCommunicationClient::FindProcesses( match_info.GetProcessInfo().GetArchitecture(); const llvm::Triple &triple = match_arch.GetTriple(); packet.PutCString("triple:"); - packet.PutCString(triple.getTriple().c_str()); + packet.PutCString(triple.getTriple()); packet.PutChar(';'); } } @@ -3201,7 +3201,7 @@ bool GDBRemoteCommunicationClient::GetModuleInfo( StringExtractor extractor(value); std::string path; extractor.GetHexByteString(path); - module_spec.GetFileSpec() = FileSpec(path.c_str(), false, arch_spec); + module_spec.GetFileSpec() = FileSpec(path, false, arch_spec); } } @@ -3322,7 +3322,7 @@ bool GDBRemoteCommunicationClient::ReadExtFeature( << "," << std::hex << size; GDBRemoteCommunication::PacketResult res = - SendPacketAndWaitForResponse(packet.str().c_str(), chunk, false); + SendPacketAndWaitForResponse(packet.str(), chunk, false); if (res != GDBRemoteCommunication::PacketResult::Success) { err.SetErrorString("Error sending $qXfer packet"); @@ -3609,8 +3609,8 @@ Error GDBRemoteCommunicationClient::ConfigureRemoteStructuredData( // Send the packet. const bool send_async = false; StringExtractorGDBRemote response; - auto result = SendPacketAndWaitForResponse(stream.GetString().c_str(), - response, send_async); + auto result = + SendPacketAndWaitForResponse(stream.GetString(), response, send_async); if (result == PacketResult::Success) { // We failed if the config result comes back other than OK. if (strcmp(response.GetStringRef().c_str(), "OK") == 0) { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 7c46c21261d..28d94f8949a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -358,8 +358,7 @@ GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo( StringExtractor extractor(value); std::string file; extractor.GetHexByteString(file); - match_info.GetProcessInfo().GetExecutableFile().SetFile(file.c_str(), - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile(file, false); } else if (key.equals("name_match")) { NameMatchType name_match = llvm::StringSwitch<NameMatchType>(value) @@ -644,8 +643,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Size( std::string path; packet.GetHexByteString(path); if (!path.empty()) { - lldb::user_id_t retcode = - FileSystem::GetFileSize(FileSpec(path.c_str(), false)); + lldb::user_id_t retcode = FileSystem::GetFileSize(FileSpec(path, false)); StreamString response; response.PutChar('F'); response.PutHex64(retcode); @@ -684,7 +682,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Exists( std::string path; packet.GetHexByteString(path); if (!path.empty()) { - bool retcode = FileSystem::GetFileExists(FileSpec(path.c_str(), false)); + bool retcode = FileSystem::GetFileExists(FileSpec(path, false)); StreamString response; response.PutChar('F'); response.PutChar(','); @@ -776,7 +774,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_MD5( if (!path.empty()) { uint64_t a, b; StreamGDBRemote response; - if (!FileSystem::CalculateMD5(FileSpec(path.c_str(), false), a, b)) { + if (!FileSystem::CalculateMD5(FileSpec(path, false), a, b)) { response.PutCString("F,"); response.PutCString("x"); } else { @@ -1031,8 +1029,7 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) { if (success) { if (arg_idx == 0) - m_process_launch_info.GetExecutableFile().SetFile(arg.c_str(), - false); + m_process_launch_info.GetExecutableFile().SetFile(arg, false); m_process_launch_info.GetArguments().AppendArgument(arg); if (log) log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"", @@ -1276,7 +1273,7 @@ FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile( #ifdef __ANDROID__ return HostInfoAndroid::ResolveLibraryPath(module_path, arch); #else - return FileSpec(module_path.c_str(), true); + return FileSpec(module_path, true); #endif } @@ -1284,7 +1281,7 @@ ModuleSpec GDBRemoteCommunicationServerCommon::GetModuleInfo( const std::string &module_path, const std::string &triple) { ArchSpec arch(triple.c_str()); - const FileSpec req_module_path_spec(module_path.c_str(), true); + const FileSpec req_module_path_spec(module_path, true); const FileSpec module_path_spec = FindModuleFile(req_module_path_spec.GetPath(), arch); const ModuleSpec module_spec(module_path_spec, arch); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 754cdb03de5..0897611e6d6 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -667,7 +667,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread( if (::strcspn(thread_name.c_str(), "$#+-;:") == thread_name_len) { response.PutCString("name:"); - response.PutCString(thread_name.c_str()); + response.PutCString(thread_name); } else { // The thread name contains special chars, send as hex bytes. response.PutCString("hexname:"); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 80d6b8a756d..33b60b5711d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -128,7 +128,7 @@ Error GDBRemoteCommunicationServerPlatform::LaunchGDBServer( std::string platform_ip; int platform_port; std::string platform_path; - bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme, + bool ok = UriParser::Parse(GetConnection()->GetURI(), platform_scheme, platform_ip, platform_port, platform_path); UNUSED_IF_ASSERT_DISABLED(ok); assert(ok); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index f96bfe7baeb..4a3cc7f7a34 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2321,7 +2321,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) { reason = "watchpoint"; StreamString ostr; ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index); - description = ostr.GetString().c_str(); + description = ostr.GetString(); } else if (key.compare("library") == 0) { LoadModules(); } else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) { @@ -4579,7 +4579,7 @@ size_t ProcessGDBRemote::LoadModules(LoadedModuleInfoList &module_list) { if (!modInfo.get_link_map(link_map)) link_map = LLDB_INVALID_ADDRESS; - FileSpec file(mod_name.c_str(), true); + FileSpec file(mod_name, true); lldb::ModuleSP module_sp = LoadModuleAtAddress(file, link_map, mod_base, mod_base_is_offset); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index f2f3d5be9ff..f3453f2d011 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -1021,7 +1021,7 @@ uint32_t PythonFile::GetOptionsFromMode(llvm::StringRef mode) { if (mode.empty()) return 0; - return llvm::StringSwitch<uint32_t>(mode.str().c_str()) + return llvm::StringSwitch<uint32_t>(mode.str()) .Case("r", File::eOpenOptionRead) .Case("w", File::eOpenOptionWrite) .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend | diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index ed86dfcf813..185c3ef98e9 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -1818,7 +1818,7 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, // Display the activity chain, from parent-most to child-most // activity, separated by a colon (:). stream.PutCString("activity-chain="); - stream.PutCString(activity_chain.c_str()); + stream.PutCString(activity_chain); #else if (GetGlobalProperties()->GetDisplayActivityChain()) { // Display the activity chain, from parent-most to child-most @@ -1850,7 +1850,7 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, if (header_count > 0) stream.PutChar(','); stream.PutCString("subsystem="); - stream.PutCString(subsystem.c_str()); + stream.PutCString(subsystem); ++header_count; } } @@ -1862,14 +1862,14 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, if (header_count > 0) stream.PutChar(','); stream.PutCString("category="); - stream.PutCString(category.c_str()); + stream.PutCString(category); ++header_count; } } stream.PutCString("] "); auto &result = stream.GetString(); - output_stream.PutCString(result.c_str()); + output_stream.PutCString(result); return result.size(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp index 6b8317c21db..4518d65811b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp @@ -140,7 +140,7 @@ void DWARFDebugPubnamesSet::Find( DescriptorConstIter pos; DescriptorConstIter end = m_descriptors.end(); for (pos = m_descriptors.begin(); pos != end; ++pos) { - if (regex.Execute(pos->name.c_str())) + if (regex.Execute(pos->name)) die_offset_coll.push_back(m_header.die_offset + pos->offset); } } diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index cb5ee589316..cd99493c239 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -470,7 +470,7 @@ void SymbolFilePDB::FindTypesByName(const std::string &name, lldb_private::TypeMap &types) { auto global = m_session_up->getGlobalScope(); std::unique_ptr<IPDBEnumSymbols> results; - results = global->findChildren(PDB_SymType::None, name.c_str(), + results = global->findChildren(PDB_SymType::None, name, PDB_NameSearchFlags::NS_Default); uint32_t matches = 0; |