diff --git a/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h --- a/lldb/include/lldb/Expression/REPL.h +++ b/lldb/include/lldb/Expression/REPL.h @@ -131,7 +131,7 @@ virtual Status DoInitialization() = 0; - virtual ConstString GetSourceFileBasename() = 0; + virtual llvm::StringRef GetSourceFileBasename() = 0; virtual const char *GetAutoIndentCharacters() = 0; diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -57,14 +57,14 @@ } std::string REPL::GetSourcePath() { - ConstString file_basename = GetSourceFileBasename(); + llvm::StringRef file_basename = GetSourceFileBasename(); FileSpec tmpdir_file_spec = HostInfo::GetProcessTempDir(); if (tmpdir_file_spec) { tmpdir_file_spec.SetFilename(file_basename); m_repl_source_path = tmpdir_file_spec.GetPath(); } else { tmpdir_file_spec = FileSpec("/tmp"); - tmpdir_file_spec.AppendPathComponent(file_basename.GetStringRef()); + tmpdir_file_spec.AppendPathComponent(file_basename); } return tmpdir_file_spec.GetPath(); diff --git a/lldb/source/Plugins/REPL/Clang/ClangREPL.h b/lldb/source/Plugins/REPL/Clang/ClangREPL.h --- a/lldb/source/Plugins/REPL/Clang/ClangREPL.h +++ b/lldb/source/Plugins/REPL/Clang/ClangREPL.h @@ -36,7 +36,7 @@ protected: Status DoInitialization() override; - ConstString GetSourceFileBasename() override; + llvm::StringRef GetSourceFileBasename() override; const char *GetAutoIndentCharacters() override; diff --git a/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp b/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp --- a/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp +++ b/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp @@ -62,8 +62,9 @@ Status ClangREPL::DoInitialization() { return Status(); } -ConstString ClangREPL::GetSourceFileBasename() { - return ConstString("repl.c"); +llvm::StringRef ClangREPL::GetSourceFileBasename() { + static constexpr llvm::StringLiteral g_repl("repl.c"); + return g_repl; } const char *ClangREPL::GetAutoIndentCharacters() { return " "; }