Author: zturner Date: Fri Sep 23 17:11:51 2016 New Revision: 282306 URL: http://llvm.org/viewvc/llvm-project?rev=282306&view=rev Log: Change FileAction::GetPath() to return a StringRef.
Modified: lldb/trunk/include/lldb/Target/FileAction.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp lldb/trunk/source/Target/FileAction.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Target/FileAction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/FileAction.h?rev=282306&r1=282305&r2=282306&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/FileAction.h (original) +++ lldb/trunk/include/lldb/Target/FileAction.h Fri Sep 23 17:11:51 2016 @@ -40,7 +40,7 @@ public: int GetActionArgument() const { return m_arg; } - const char *GetPath() const; + llvm::StringRef GetPath() const; const FileSpec &GetFileSpec() const; Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=282306&r1=282305&r2=282306&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Fri Sep 23 17:11:51 2016 @@ -137,16 +137,16 @@ public: uint32_t GetMaximumMemReadSize() const; FileSpec GetStandardInputPath() const; - - void SetStandardInputPath(const char *path); - - FileSpec GetStandardOutputPath() const; - - void SetStandardOutputPath(const char *path); - FileSpec GetStandardErrorPath() const; + FileSpec GetStandardOutputPath() const; - void SetStandardErrorPath(const char *path); + void SetStandardInputPath(llvm::StringRef path); + void SetStandardOutputPath(llvm::StringRef path); + void SetStandardErrorPath(llvm::StringRef path); + + void SetStandardInputPath(const char *path) = delete; + void SetStandardOutputPath(const char *path) = delete; + void SetStandardErrorPath(const char *path) = delete; bool GetBreakpointsConsultPlatformAvoidList(); Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=282306&r1=282305&r2=282306&view=diff ============================================================================== --- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original) +++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Fri Sep 23 17:11:51 2016 @@ -124,7 +124,7 @@ ProcessLauncherWindows::GetStdioHandle(c secattr.nLength = sizeof(SECURITY_ATTRIBUTES); secattr.bInheritHandle = TRUE; - const char *path = action->GetPath(); + llvm::StringRef path = action->GetPath(); DWORD access = 0; DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; DWORD create = 0; Modified: lldb/trunk/source/Target/FileAction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/FileAction.cpp?rev=282306&r1=282305&r2=282306&view=diff ============================================================================== --- lldb/trunk/source/Target/FileAction.cpp (original) +++ lldb/trunk/source/Target/FileAction.cpp Fri Sep 23 17:11:51 2016 @@ -29,7 +29,7 @@ void FileAction::Clear() { m_file_spec.Clear(); } -const char *FileAction::GetPath() const { return m_file_spec.GetCString(); } +llvm::StringRef FileAction::GetPath() const { return m_file_spec.GetCString(); } const FileSpec &FileAction::GetFileSpec() const { return m_file_spec; } Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=282306&r1=282305&r2=282306&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Fri Sep 23 17:11:51 2016 @@ -3817,10 +3817,9 @@ FileSpec TargetProperties::GetStandardIn return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx); } -void TargetProperties::SetStandardInputPath(const char *p) { +void TargetProperties::SetStandardInputPath(llvm::StringRef path) { const uint32_t idx = ePropertyInputPath; - m_collection_sp->SetPropertyAtIndexAsString( - nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); + m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, path); } FileSpec TargetProperties::GetStandardOutputPath() const { @@ -3828,10 +3827,9 @@ FileSpec TargetProperties::GetStandardOu return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx); } -void TargetProperties::SetStandardOutputPath(const char *p) { +void TargetProperties::SetStandardOutputPath(llvm::StringRef path) { const uint32_t idx = ePropertyOutputPath; - m_collection_sp->SetPropertyAtIndexAsString( - nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); + m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, path); } FileSpec TargetProperties::GetStandardErrorPath() const { @@ -3839,6 +3837,11 @@ FileSpec TargetProperties::GetStandardEr return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx); } +void TargetProperties::SetStandardErrorPath(llvm::StringRef path) { + const uint32_t idx = ePropertyErrorPath; + m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, path); +} + LanguageType TargetProperties::GetLanguage() const { OptionValueLanguage *value = m_collection_sp->GetPropertyAtIndexAsOptionValueLanguage( @@ -3862,12 +3865,6 @@ const char *TargetProperties::GetExpress return nullptr; } -void TargetProperties::SetStandardErrorPath(const char *p) { - const uint32_t idx = ePropertyErrorPath; - m_collection_sp->SetPropertyAtIndexAsString( - nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); -} - bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() { const uint32_t idx = ePropertyBreakpointUseAvoidList; return m_collection_sp->GetPropertyAtIndexAsBoolean( @@ -3963,23 +3960,17 @@ void TargetProperties::SetProcessLaunchI const FileAction *input_file_action = launch_info.GetFileActionForFD(STDIN_FILENO); if (input_file_action) { - const char *input_path = input_file_action->GetPath(); - if (input_path) - SetStandardInputPath(input_path); + SetStandardInputPath(input_file_action->GetPath()); } const FileAction *output_file_action = launch_info.GetFileActionForFD(STDOUT_FILENO); if (output_file_action) { - const char *output_path = output_file_action->GetPath(); - if (output_path) - SetStandardOutputPath(output_path); + SetStandardOutputPath(output_file_action->GetPath()); } const FileAction *error_file_action = launch_info.GetFileActionForFD(STDERR_FILENO); if (error_file_action) { - const char *error_path = error_file_action->GetPath(); - if (error_path) - SetStandardErrorPath(error_path); + SetStandardErrorPath(error_file_action->GetPath()); } SetDetachOnError(launch_info.GetFlags().Test(lldb::eLaunchFlagDetachOnError)); SetDisableASLR(launch_info.GetFlags().Test(lldb::eLaunchFlagDisableASLR)); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits