[Lldb-commits] [PATCH] D151003: [Damangle] convert dlangDemangle to use std::string_view

2023-06-05 Thread Eli Friedman via Phabricator via lldb-commits
efriedma added inline comments.



Comment at: llvm/lib/Demangle/DLangDemangle.cpp:555
 
-Demangler D = Demangler(MangledName);
-MangledName = D.parseMangle(&Demangled);
+Demangler D(MangledName.data());
+const char *M = D.parseMangle(&Demangled);

Isn't this still assuming MangledName is null-terminated?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151003/new/

https://reviews.llvm.org/D151003

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151003: [Damangle] convert dlangDemangle to use std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added inline comments.



Comment at: llvm/lib/Demangle/DLangDemangle.cpp:555
 
-Demangler D = Demangler(MangledName);
-MangledName = D.parseMangle(&Demangled);
+Demangler D(MangledName.data());
+const char *M = D.parseMangle(&Demangled);

efriedma wrote:
> Isn't this still assuming MangledName is null-terminated?
(I have a rewrite of the D language demangler to use std::string_view 
throughout, which I will post shortly; I believe that addresses your concern)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151003/new/

https://reviews.llvm.org/D151003

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152176: [Demangle] convert microsoftDemangle to take a std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers created this revision.
Herald added a subscriber: hiraditya.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

This should be last of the "bottom-up conversions" of various demanglers
to accept std::string_view.  After this, D149104 
 may be revisited.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152176

Files:
  lldb/source/Core/Mangled.cpp
  llvm/include/llvm/Demangle/Demangle.h
  llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
  llvm/lib/Demangle/MicrosoftDemangle.cpp
  llvm/tools/llvm-objdump/COFFDump.cpp
  llvm/tools/llvm-undname/llvm-undname.cpp

Index: llvm/tools/llvm-undname/llvm-undname.cpp
===
--- llvm/tools/llvm-undname/llvm-undname.cpp
+++ llvm/tools/llvm-undname/llvm-undname.cpp
@@ -75,7 +75,7 @@
 Flags = MSDemangleFlags(Flags | MSDF_NoVariableType);
 
   size_t NRead;
-  char *ResultBuf = microsoftDemangle(S.c_str(), &NRead, &Status, Flags);
+  char *ResultBuf = microsoftDemangle(S, &NRead, &Status, Flags);
   if (Status == llvm::demangle_success) {
 outs() << ResultBuf << "\n";
 outs().flush();
Index: llvm/tools/llvm-objdump/COFFDump.cpp
===
--- llvm/tools/llvm-objdump/COFFDump.cpp
+++ llvm/tools/llvm-objdump/COFFDump.cpp
@@ -852,7 +852,7 @@
<< Name;
 if (Demangle && Name.startswith("?")) {
   int Status = -1;
-  char *DemangledSymbol = microsoftDemangle(Name.data(), nullptr, &Status);
+  char *DemangledSymbol = microsoftDemangle(Name, nullptr, &Status);
 
   if (Status == 0 && DemangledSymbol) {
 outs() << " (" << StringRef(DemangledSymbol) << ")";
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2397,14 +2397,14 @@
 std::printf("\n");
 }
 
-char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
+char *llvm::microsoftDemangle(std::string_view MangledName, size_t *NMangled,
   int *Status, MSDemangleFlags Flags) {
   Demangler D;
 
   std::string_view Name{MangledName};
   SymbolNode *AST = D.parse(Name);
   if (!D.Error && NMangled)
-*NMangled = Name.empty() ? 0 : &*Name.begin() - MangledName;
+*NMangled = Name.empty() ? 0 : &*Name.begin() - &*MangledName.begin();
 
   if (Flags & MSDF_DumpBackrefs)
 D.dumpBackReferences();
Index: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
===
--- llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -686,7 +686,7 @@
 // Only do MSVC C++ demangling on symbols starting with '?'.
 int status = 0;
 char *DemangledName = microsoftDemangle(
-Name.c_str(), nullptr, &status,
+Name, nullptr, &status,
 MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
 MSDF_NoMemberType | MSDF_NoReturnType));
 if (status != 0)
Index: llvm/include/llvm/Demangle/Demangle.h
===
--- llvm/include/llvm/Demangle/Demangle.h
+++ llvm/include/llvm/Demangle/Demangle.h
@@ -51,8 +51,8 @@
 /// bytes of the input string were consumed.
 /// status receives one of the demangle_ enum entries above if it's not nullptr.
 /// Flags controls various details of the demangled representation.
-char *microsoftDemangle(const char *mangled_name, size_t *n_read, int *status,
-MSDemangleFlags Flags = MSDF_None);
+char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
+int *status, MSDemangleFlags Flags = MSDF_None);
 
 // Demangles a Rust v0 mangled symbol.
 char *rustDemangle(std::string_view MangledName);
Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -107,7 +107,7 @@
 }
 
 // Local helpers for different demangling implementations.
-static char *GetMSVCDemangledStr(const char *M) {
+static char *GetMSVCDemangledStr(std::string_view M) {
   char *demangled_cstr = llvm::microsoftDemangle(
   M, nullptr, nullptr,
   llvm::MSDemangleFlags(
@@ -116,9 +116,9 @@
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
-  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
+  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M.data(), demangled_cstr);
 else
-  LLDB_LOGF(log, "demangled msvc: %s -> error", M);
+  LLDB_LOGF(log, "demangled msvc: %s -> error", M.data()

[Lldb-commits] [PATCH] D151003: [Damangle] convert dlangDemangle to use std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added inline comments.



Comment at: llvm/lib/Demangle/DLangDemangle.cpp:555
 
-Demangler D = Demangler(MangledName);
-MangledName = D.parseMangle(&Demangled);
+Demangler D(MangledName.data());
+const char *M = D.parseMangle(&Demangled);

nickdesaulniers wrote:
> efriedma wrote:
> > Isn't this still assuming MangledName is null-terminated?
> (I have a rewrite of the D language demangler to use std::string_view 
> throughout, which I will post shortly; I believe that addresses your concern)
D152177 PTAL


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151003/new/

https://reviews.llvm.org/D151003

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 65ceb42 - Replace deprecated startswith_insensitive with starts_with_insensitive

2023-06-05 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-06-05T11:01:27-07:00
New Revision: 65ceb42d636ea758a2c9ecdfb7473d528983a1e2

URL: 
https://github.com/llvm/llvm-project/commit/65ceb42d636ea758a2c9ecdfb7473d528983a1e2
DIFF: 
https://github.com/llvm/llvm-project/commit/65ceb42d636ea758a2c9ecdfb7473d528983a1e2.diff

LOG: Replace deprecated startswith_insensitive with starts_with_insensitive

Added: 


Modified: 
clang/lib/Driver/ToolChains/MSVC.cpp
lldb/source/DataFormatters/FormatManager.cpp
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp 
b/clang/lib/Driver/ToolChains/MSVC.cpp
index 5e66bb9d1f88a..2ffe0d56835c5 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -381,7 +381,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   // find it.
   for (const char *Cursor = EnvBlock.data(); *Cursor != '\0';) {
 llvm::StringRef EnvVar(Cursor);
-if (EnvVar.startswith_insensitive("path=")) {
+if (EnvVar.starts_with_insensitive("path=")) {
   constexpr size_t PrefixLen = 5; // strlen("path=")
   Environment.push_back(Args.MakeArgString(
   EnvVar.substr(0, PrefixLen) +

diff  --git a/lldb/source/DataFormatters/FormatManager.cpp 
b/lldb/source/DataFormatters/FormatManager.cpp
index 8387ce1121fd9..b1b5794a3efc9 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -103,7 +103,7 @@ static bool GetFormatFromFormatName(llvm::StringRef 
format_name,
   if (partial_match_ok) {
 for (i = 0; i < g_num_format_infos; ++i) {
   if (llvm::StringRef(g_format_infos[i].format_name)
-  .startswith_insensitive(format_name)) {
+  .starts_with_insensitive(format_name)) {
 format = g_format_infos[i].format;
 return true;
   }

diff  --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp 
b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
index 7c79f2abe47e6..1a67c1676482a 100644
--- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -13749,13 +13749,13 @@ bool EmulateInstructionARM::SetArchitecture(const 
ArchSpec &arch) {
 m_arm_isa = ARMvAll;
   else if (arch_cstr.equals_insensitive("thumb"))
 m_arm_isa = ARMvAll;
-  else if (arch_cstr.startswith_insensitive("armv4"))
+  else if (arch_cstr.starts_with_insensitive("armv4"))
 m_arm_isa = ARMv4;
-  else if (arch_cstr.startswith_insensitive("armv6"))
+  else if (arch_cstr.starts_with_insensitive("armv6"))
 m_arm_isa = ARMv6;
-  else if (arch_cstr.startswith_insensitive("armv7"))
+  else if (arch_cstr.starts_with_insensitive("armv7"))
 m_arm_isa = ARMv7;
-  else if (arch_cstr.startswith_insensitive("armv8"))
+  else if (arch_cstr.starts_with_insensitive("armv8"))
 m_arm_isa = ARMv8;
   return m_arm_isa != 0;
 }

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 5baff9f9a61c6..3d709e3d67595 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1465,7 +1465,7 @@ bool CPlusPlusLanguage::IsSourceFile(llvm::StringRef 
file_path) const {
   const auto suffixes = {".cpp", ".cxx", ".c++", ".cc",  ".c",
  ".h",   ".hh",  ".hpp", ".hxx", ".h++"};
   for (auto suffix : suffixes) {
-if (file_path.endswith_insensitive(suffix))
+if (file_path.ends_with_insensitive(suffix))
   return true;
   }
 

diff  --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp 
b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
index 762f662d5773b..82b037129c244 100644
--- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -1035,7 +1035,7 @@ bool ObjCLanguage::IsNilReference(ValueObject &valobj) {
 bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const {
   const auto suffixes = {".h", ".m", ".M"};
   for (auto suffix : suffixes) {
-if (file_path.endswith_insensitive(suffix))
+if (file_path.ends_with_insensitive(suffix))
   return true;
   }
   return false;

diff  --git 
a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
index 700dda3d33bb0..79830e529df2d 100644
--- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
+++ b/lldb/sourc

[Lldb-commits] [PATCH] D152189: [LLDB][PDB] Fix age field in UUID in PDB file.

2023-06-05 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu created this revision.
zequanwu added reviewers: labath, rnk, aganea.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

There are two age fields in a PDB file. One from the PDB Stream and another one
from the DBI stream.

According to 
https://randomascii.wordpress.com/2011/11/11/source-indexing-is-underused-awesomeness/#comment-34328,
The age in DBI stream is used to against the binary's age. `Pdbstr.exe` is used
to only increment the age from PDB stream without changing the DBI age. I
also verified this by manually changing the DBI age of a PDB file and let
`windbg.exe` to load it. It shows the following logs before and after changing:

Before:

  SYMSRV:  BYINDEX: 0xA
   c:\symbols*https://msdl.microsoft.com/download/symbols
   nlaapi.pdb
   D72AA69CD5ABE5D28C74FADB17DE3F8C1
  SYMSRV:  PATH: 
c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
  SYMSRV:  RESULT: 0x
  *** WARNING: Unable to verify checksum for NLAapi.dll
  DBGHELP: NLAapi - public symbols
  c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
  ...

After:

  SYMSRV:  BYINDEX: 0xA
   c:\symbols*https://msdl.microsoft.com/download/symbols
   nlaapi.pdb
   D72AA69CD5ABE5D28C74FADB17DE3F8C1
  SYMSRV:  PATH: 
c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
  SYMSRV:  RESULT: 0x
  DBGHELP: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - 
mismatched pdb
  SYMSRV:  BYINDEX: 0xB
   
c:\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com
   nlaapi.pdb
   D72AA69CD5ABE5D28C74FADB17DE3F8C1
  SYMSRV:  PATH: 
c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
  SYMSRV:  RESULT: 0x
  DBGHELP: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - 
mismatched pdb
  SYMSRV:  BYINDEX: 0xC
   c:\src\symbols*https://msdl.microsoft.com/download/symbols
   nlaapi.pdb
   D72AA69CD5ABE5D28C74FADB17DE3F8C1
  SYMSRV:  PATH: 
c:\src\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
  SYMSRV:  RESULT: 0x
  *** WARNING: Unable to verify checksum for NLAapi.dll
  DBGHELP: NLAapi - public symbols
  c:\src\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb

So, `windbg.exe` uses the DBI age to detect mismatched pdb, but it still loads
the pdb even if the age mismatched. Probably lldb should do the same and give
some warnings.

This fixes a bug that lldb can't load some windows system pdbs due to mismatched
uuid.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152189

Files:
  lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
  lldb/test/Shell/ObjectFile/PDB/object.test


Index: lldb/test/Shell/ObjectFile/PDB/object.test
===
--- lldb/test/Shell/ObjectFile/PDB/object.test
+++ lldb/test/Shell/ObjectFile/PDB/object.test
@@ -3,7 +3,7 @@
 
 # CHECK: Plugin name: pdb
 # CHECK: Architecture: x86_64-pc-windows-msvc
-# CHECK: UUID: 61AF583F-29A8-7A6C-4C4C-44205044422E-0001
+# CHECK: UUID: 61AF583F-29A8-7A6C-4C4C-44205044422E-0003
 # CHECK: Executable: false
 # CHECK: Stripped: false
 # CHECK: Type: debug info
@@ -52,7 +52,7 @@
   Version: VC70
 DbiStream:
   VerHeader:   V70
-  Age: 1
+  Age: 3
   BuildNumber: 36363
   PdbDllVersion:   0
   PdbDllRbld:  0
Index: lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
===
--- lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
+++ lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
@@ -27,10 +27,10 @@
 
 LLDB_PLUGIN_DEFINE(ObjectFilePDB)
 
-static UUID GetPDBUUID(InfoStream &IS) {
+static UUID GetPDBUUID(InfoStream &IS, DbiStream &DS) {
   UUID::CvRecordPdb70 debug_info;
   memcpy(&debug_info.Uuid, IS.getGuid().Guid, sizeof(debug_info.Uuid));
-  debug_info.Age = IS.getAge();
+  debug_info.Age = DS.getAge();
   return UUID(debug_info);
 }
 
@@ -82,7 +82,12 @@
 llvm::consumeError(info_stream.takeError());
 return false;
   }
-  m_uuid = GetPDBUUID(*info_stream);
+  auto dbi_stream = m_file_up->getPDBDbiStream();
+  if (!dbi_stream) {
+llvm::consumeError(dbi_stream.takeError());
+return false;
+  }
+  m_uuid = GetPDBUUID(*info_stream, *dbi_stream);
   return true;
 }
 
@@ -126,7 +131,7 @@
   }
 
   lldb_private::UUID &uuid = module_spec.GetUUID();
-  uuid = GetPDBUUID(*info_stream);
+  uuid = GetPDBUUID(*info_stream, *dbi_stream);
 
   ArchSpec &module_arch = module_spec.GetArchitecture();
   switch (dbi_stream->getMachineType()) {


Index: lldb/test/Shell/ObjectFile/PDB/object.test
===
--- lldb/test/Shell/ObjectFile/PDB/object.test
+++ lldb/test/Shell/ObjectFile/PDB/o

[Lldb-commits] [lldb] 0bb6f83 - [lldb][NFCI] Change return type of REPL::GetSourceFileBasename

2023-06-05 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-06-05T12:52:38-07:00
New Revision: 0bb6f832fbf8ae022063c07e2090f07832136bd4

URL: 
https://github.com/llvm/llvm-project/commit/0bb6f832fbf8ae022063c07e2090f07832136bd4
DIFF: 
https://github.com/llvm/llvm-project/commit/0bb6f832fbf8ae022063c07e2090f07832136bd4.diff

LOG: [lldb][NFCI] Change return type of REPL::GetSourceFileBasename

These don't really need to be in the ConstString StringPool. I've
changed the return type to StringRef because on llvm.org and downstream
in the swift fork, this returns a constant value. We could change it to
return a std::string or something else if it needs to be able to change
between calls.

Differential Revision: https://reviews.llvm.org/D151962

Added: 


Modified: 
lldb/include/lldb/Expression/REPL.h
lldb/source/Expression/REPL.cpp
lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
lldb/source/Plugins/REPL/Clang/ClangREPL.h

Removed: 




diff  --git a/lldb/include/lldb/Expression/REPL.h 
b/lldb/include/lldb/Expression/REPL.h
index 1438afdf872bf..95a3a6ebae57e 100644
--- a/lldb/include/lldb/Expression/REPL.h
+++ b/lldb/include/lldb/Expression/REPL.h
@@ -131,7 +131,7 @@ class REPL : public IOHandlerDelegate,
 
   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
index e98ab1e575032..9bb7461e9ad79 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -57,14 +57,14 @@ lldb::REPLSP REPL::Create(Status &err, lldb::LanguageType 
language,
 }
 
 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.cpp 
b/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
index 36d8ffe74f7c5..0aaddad53126e 100644
--- a/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ b/lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
@@ -62,8 +62,9 @@ lldb::REPLSP ClangREPL::CreateInstance(Status &error,
 
 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 "  "; }

diff  --git a/lldb/source/Plugins/REPL/Clang/ClangREPL.h 
b/lldb/source/Plugins/REPL/Clang/ClangREPL.h
index 46dcd676ef7ee..7d219c46189ea 100644
--- a/lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ b/lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -36,7 +36,7 @@ class ClangREPL : public llvm::RTTIExtends {
 protected:
   Status DoInitialization() override;
 
-  ConstString GetSourceFileBasename() override;
+  llvm::StringRef GetSourceFileBasename() override;
 
   const char *GetAutoIndentCharacters() override;
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151962: [lldb][NFCI] Change return type of REPL::GetSourceFileBasename

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0bb6f832fbf8: [lldb][NFCI] Change return type of 
REPL::GetSourceFileBasename (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151962/new/

https://reviews.llvm.org/D151962

Files:
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.h


Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ 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;
 
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ 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 "  "; }
Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ 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();
Index: lldb/include/lldb/Expression/REPL.h
===
--- lldb/include/lldb/Expression/REPL.h
+++ 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;
 


Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ 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;
 
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ 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 "  "; }
Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ 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();
Index: lldb/include/lldb/Expression/REPL.h
===
--- lldb/include/lldb/Expression/REPL.h
+++ 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;
 
_

[Lldb-commits] [PATCH] D151949: [lldb][NFCI] Use size_t in OptionValueProperties

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0871f22edca5: [lldb][NFCI] Use size_t in 
OptionValueProperties (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151949/new/

https://reviews.llvm.org/D151949

Files:
  lldb/include/lldb/Interpreter/OptionValueProperties.h
  lldb/source/Interpreter/OptionValueProperties.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp

Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -79,7 +79,7 @@
   ThreadOptionValueProperties(ConstString name) : Cloneable(name) {}
 
   const Property *
-  GetPropertyAtIndex(uint32_t idx,
+  GetPropertyAtIndex(size_t idx,
  const ExecutionContext *exe_ctx) const override {
 // When getting the value for a key from the thread options, we will always
 // try and grab the setting from the current thread if there is one. Else
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -4008,7 +4008,7 @@
   TargetOptionValueProperties(ConstString name) : Cloneable(name) {}
 
   const Property *
-  GetPropertyAtIndex(uint32_t idx,
+  GetPropertyAtIndex(size_t idx,
  const ExecutionContext *exe_ctx = nullptr) const override {
 // When getting the value for a key from the target options, we will always
 // try and grab the setting from the current target if there is one. Else
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -93,7 +93,7 @@
   ProcessOptionValueProperties(ConstString name) : Cloneable(name) {}
 
   const Property *
-  GetPropertyAtIndex(uint32_t idx,
+  GetPropertyAtIndex(size_t idx,
  const ExecutionContext *exe_ctx) const override {
 // When getting the value for a key from the process options, we will
 // always try and grab the setting from the current process if there is
Index: lldb/source/Interpreter/OptionValueProperties.cpp
===
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -35,7 +35,7 @@
 }
 
 void OptionValueProperties::SetValueChangedCallback(
-uint32_t property_idx, std::function callback) {
+size_t property_idx, std::function callback) {
   Property *property = ProtectedGetPropertyAtIndex(property_idx);
   if (property)
 property->SetValueChangedCallback(std::move(callback));
@@ -138,7 +138,7 @@
   return error;
 }
 
-uint32_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
+size_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
   return m_name_to_index.Find(name, SIZE_MAX);
 }
 
@@ -149,7 +149,7 @@
 }
 
 lldb::OptionValueSP OptionValueProperties::GetPropertyValueAtIndex(
-uint32_t idx, const ExecutionContext *exe_ctx) const {
+size_t idx, const ExecutionContext *exe_ctx) const {
   const Property *setting = GetPropertyAtIndex(idx, exe_ctx);
   if (setting)
 return setting->GetValue();
@@ -158,7 +158,7 @@
 
 OptionValuePathMappings *
 OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings(
-uint32_t idx, const ExecutionContext *exe_ctx) const {
+size_t idx, const ExecutionContext *exe_ctx) const {
   OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
   if (value_sp)
 return value_sp->GetAsPathMappings();
@@ -167,7 +167,7 @@
 
 OptionValueFileSpecList *
 OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpecList(
-uint32_t idx, const ExecutionContext *exe_ctx) const {
+size_t idx, const ExecutionContext *exe_ctx) const {
   OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
   if (value_sp)
 return value_sp->GetAsFileSpecList();
@@ -175,7 +175,7 @@
 }
 
 bool OptionValueProperties::GetPropertyAtIndexAsArgs(
-uint32_t idx, Args &args, const ExecutionContext *exe_ctx) const {
+size_t idx, Args &args, const ExecutionContext *exe_ctx) const {
   const Property *property = GetPropertyAtIndex(idx, exe_ctx);
   if (!property)
 return false;
@@ -206,7 +206,7 @@
 }
 
 bool OptionValueProperties::SetPropertyAtIndexFromArgs(
-uint32_t idx, const Args &args, const ExecutionContext *exe_ctx) {
+size_t idx, const Args &args, const ExecutionContext *exe_ctx) {
   const Property *property = GetPropertyAtIndex(idx, exe_ctx);
   if (!property)
 return false;
@@ -232,7 +232,7 @@
 
 OptionValueDictionary *
 OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
-uint32_t idx, const ExecutionContext *exe_ctx) const {
+size_t idx, const

[Lldb-commits] [lldb] 0871f22 - [lldb][NFCI] Use size_t in OptionValueProperties

2023-06-05 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-06-05T12:57:43-07:00
New Revision: 0871f22edca5036dad2aba0c4461a3975651b0c3

URL: 
https://github.com/llvm/llvm-project/commit/0871f22edca5036dad2aba0c4461a3975651b0c3
DIFF: 
https://github.com/llvm/llvm-project/commit/0871f22edca5036dad2aba0c4461a3975651b0c3.diff

LOG: [lldb][NFCI] Use size_t in OptionValueProperties

In many places we're using uint32_t where we should be using size_t.
We should be consistent.

Differential Revision: https://reviews.llvm.org/D151949

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h 
b/lldb/include/lldb/Interpreter/OptionValueProperties.h
index e20ba2c3af71b..3f40290f1e21d 100644
--- a/lldb/include/lldb/Interpreter/OptionValueProperties.h
+++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h
@@ -68,7 +68,7 @@ class OptionValueProperties
   // Get the index of a property given its exact name in this property
   // collection, "name" can't be a path to a property path that refers to a
   // property within a property
-  virtual uint32_t GetPropertyIndex(ConstString name) const;
+  virtual size_t GetPropertyIndex(ConstString name) const;
 
   // Get a property by exact name exists in this property collection, name can
   // not be a path to a property path that refers to a property within a
@@ -78,7 +78,7 @@ class OptionValueProperties
   const ExecutionContext *exe_ctx = nullptr) const;
 
   virtual const Property *
-  GetPropertyAtIndex(uint32_t idx,
+  GetPropertyAtIndex(size_t idx,
  const ExecutionContext *exe_ctx = nullptr) const {
 return ProtectedGetPropertyAtIndex(idx);
   }
@@ -91,7 +91,7 @@ class OptionValueProperties
 llvm::StringRef property_path) const;
 
   virtual lldb::OptionValueSP
-  GetPropertyValueAtIndex(uint32_t idx, const ExecutionContext *exe_ctx) const;
+  GetPropertyValueAtIndex(size_t idx, const ExecutionContext *exe_ctx) const;
 
   virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
  ConstString key) const;
@@ -104,32 +104,32 @@ class OptionValueProperties
  llvm::StringRef path, llvm::StringRef value) override;
 
   bool
-  GetPropertyAtIndexAsArgs(uint32_t idx, Args &args,
+  GetPropertyAtIndexAsArgs(size_t idx, Args &args,
const ExecutionContext *exe_ctx = nullptr) const;
 
-  bool SetPropertyAtIndexFromArgs(uint32_t idx, const Args &args,
+  bool SetPropertyAtIndexFromArgs(size_t idx, const Args &args,
   const ExecutionContext *exe_ctx = nullptr);
 
   OptionValueDictionary *GetPropertyAtIndexAsOptionValueDictionary(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValueSInt64 *GetPropertyAtIndexAsOptionValueSInt64(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValueUInt64 *GetPropertyAtIndexAsOptionValueUInt64(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValueString *GetPropertyAtIndexAsOptionValueString(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValueFileSpec *GetPropertyAtIndexAsOptionValueFileSpec(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
-  uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+  size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
 
   void AppendProperty(ConstString name, llvm::StringRef desc, bool is_global,
   const lldb::OptionValueSP &value_sp);
@@ -137,11 +137,11 @@ class OptionValueProperties
   lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
ConstString name);
 
-  void SetValueChangedCallback(uint32_t property_idx,
+  void SetValueChangedCallback(size_t property_idx,
std::function callback);
 
   template 
-  auto GetPropertyAtIndexAs(uint32_t idx,
+  auto GetPropertyA

[Lldb-commits] [lldb] db98ac0 - [Demangle] convert microsoftDemangle to take a std::string_view

2023-06-05 Thread Nick Desaulniers via lldb-commits

Author: Nick Desaulniers
Date: 2023-06-05T13:00:20-07:00
New Revision: db98ac082744880a6e352b2d4a97d8896d9a7694

URL: 
https://github.com/llvm/llvm-project/commit/db98ac082744880a6e352b2d4a97d8896d9a7694
DIFF: 
https://github.com/llvm/llvm-project/commit/db98ac082744880a6e352b2d4a97d8896d9a7694.diff

LOG: [Demangle] convert microsoftDemangle to take a std::string_view

This should be last of the "bottom-up conversions" of various demanglers
to accept std::string_view.  After this, D149104 may be revisited.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D152176

Added: 


Modified: 
lldb/source/Core/Mangled.cpp
llvm/include/llvm/Demangle/Demangle.h
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/lib/Demangle/MicrosoftDemangle.cpp
llvm/tools/llvm-objdump/COFFDump.cpp
llvm/tools/llvm-undname/llvm-undname.cpp

Removed: 




diff  --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 3294b246ae743..d1973a9a8f7f6 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -107,7 +107,7 @@ void Mangled::SetValue(ConstString name) {
 }
 
 // Local helpers for 
diff erent demangling implementations.
-static char *GetMSVCDemangledStr(const char *M) {
+static char *GetMSVCDemangledStr(std::string_view M) {
   char *demangled_cstr = llvm::microsoftDemangle(
   M, nullptr, nullptr,
   llvm::MSDemangleFlags(
@@ -116,9 +116,9 @@ static char *GetMSVCDemangledStr(const char *M) {
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
-  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
+  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M.data(), demangled_cstr);
 else
-  LLDB_LOGF(log, "demangled msvc: %s -> error", M);
+  LLDB_LOGF(log, "demangled msvc: %s -> error", M.data());
   }
 
   return demangled_cstr;
@@ -204,7 +204,7 @@ bool Mangled::GetRichManglingInfo(RichManglingContext 
&context,
 // We have no rich mangling for MSVC-mangled names yet, so first try to
 // demangle it if necessary.
 if (!m_demangled && !m_mangled.GetMangledCounterpart(m_demangled)) {
-  if (char *d = GetMSVCDemangledStr(m_mangled.GetCString())) {
+  if (char *d = GetMSVCDemangledStr(m_mangled)) {
 // Without the rich mangling info we have to demangle the full name.
 // Copy it to string pool and connect the counterparts to accelerate
 // later access in GetDemangledName().

diff  --git a/llvm/include/llvm/Demangle/Demangle.h 
b/llvm/include/llvm/Demangle/Demangle.h
index d9b830c660047..9140c94ac3cc0 100644
--- a/llvm/include/llvm/Demangle/Demangle.h
+++ b/llvm/include/llvm/Demangle/Demangle.h
@@ -51,8 +51,8 @@ enum MSDemangleFlags {
 /// bytes of the input string were consumed.
 /// status receives one of the demangle_ enum entries above if it's not 
nullptr.
 /// Flags controls various details of the demangled representation.
-char *microsoftDemangle(const char *mangled_name, size_t *n_read, int *status,
-MSDemangleFlags Flags = MSDF_None);
+char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
+int *status, MSDemangleFlags Flags = MSDF_None);
 
 // Demangles a Rust v0 mangled symbol.
 char *rustDemangle(std::string_view MangledName);

diff  --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp 
b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index aaee4f11af446..459baf7b83640 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -686,7 +686,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
 // Only do MSVC C++ demangling on symbols starting with '?'.
 int status = 0;
 char *DemangledName = microsoftDemangle(
-Name.c_str(), nullptr, &status,
+Name, nullptr, &status,
 MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
 MSDF_NoMemberType | MSDF_NoReturnType));
 if (status != 0)

diff  --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp 
b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index c3713a7dbd3ad..b38b8a1e479da 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2397,14 +2397,14 @@ void Demangler::dumpBackReferences() {
 std::printf("\n");
 }
 
-char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
+char *llvm::microsoftDemangle(std::string_view MangledName, size_t *NMangled,
   int *Status, MSDemangleFlags Flags) {
   Demangler D;
 
   std::string_view Name{MangledName};
   SymbolNode *AST = D.parse(Name);
   if (!D.Error && NMangled)
-*NMangled = Name.empty() ? 0 : &*Name.begin() - MangledName;
+*NMangled = Name.empty() ? 0 : &*Name.begin() - &*MangledName.begin();
 
   if (Flags & MSDF_DumpBackrefs)
 D.dumpBackReferences();

diff  --

[Lldb-commits] [PATCH] D152176: [Demangle] convert microsoftDemangle to take a std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb98ac082744: [Demangle] convert microsoftDemangle to take a 
std::string_view (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152176/new/

https://reviews.llvm.org/D152176

Files:
  lldb/source/Core/Mangled.cpp
  llvm/include/llvm/Demangle/Demangle.h
  llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
  llvm/lib/Demangle/MicrosoftDemangle.cpp
  llvm/tools/llvm-objdump/COFFDump.cpp
  llvm/tools/llvm-undname/llvm-undname.cpp

Index: llvm/tools/llvm-undname/llvm-undname.cpp
===
--- llvm/tools/llvm-undname/llvm-undname.cpp
+++ llvm/tools/llvm-undname/llvm-undname.cpp
@@ -75,7 +75,7 @@
 Flags = MSDemangleFlags(Flags | MSDF_NoVariableType);
 
   size_t NRead;
-  char *ResultBuf = microsoftDemangle(S.c_str(), &NRead, &Status, Flags);
+  char *ResultBuf = microsoftDemangle(S, &NRead, &Status, Flags);
   if (Status == llvm::demangle_success) {
 outs() << ResultBuf << "\n";
 outs().flush();
Index: llvm/tools/llvm-objdump/COFFDump.cpp
===
--- llvm/tools/llvm-objdump/COFFDump.cpp
+++ llvm/tools/llvm-objdump/COFFDump.cpp
@@ -852,7 +852,7 @@
<< Name;
 if (Demangle && Name.startswith("?")) {
   int Status = -1;
-  char *DemangledSymbol = microsoftDemangle(Name.data(), nullptr, &Status);
+  char *DemangledSymbol = microsoftDemangle(Name, nullptr, &Status);
 
   if (Status == 0 && DemangledSymbol) {
 outs() << " (" << StringRef(DemangledSymbol) << ")";
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2397,14 +2397,14 @@
 std::printf("\n");
 }
 
-char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
+char *llvm::microsoftDemangle(std::string_view MangledName, size_t *NMangled,
   int *Status, MSDemangleFlags Flags) {
   Demangler D;
 
   std::string_view Name{MangledName};
   SymbolNode *AST = D.parse(Name);
   if (!D.Error && NMangled)
-*NMangled = Name.empty() ? 0 : &*Name.begin() - MangledName;
+*NMangled = Name.empty() ? 0 : &*Name.begin() - &*MangledName.begin();
 
   if (Flags & MSDF_DumpBackrefs)
 D.dumpBackReferences();
Index: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
===
--- llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -686,7 +686,7 @@
 // Only do MSVC C++ demangling on symbols starting with '?'.
 int status = 0;
 char *DemangledName = microsoftDemangle(
-Name.c_str(), nullptr, &status,
+Name, nullptr, &status,
 MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
 MSDF_NoMemberType | MSDF_NoReturnType));
 if (status != 0)
Index: llvm/include/llvm/Demangle/Demangle.h
===
--- llvm/include/llvm/Demangle/Demangle.h
+++ llvm/include/llvm/Demangle/Demangle.h
@@ -51,8 +51,8 @@
 /// bytes of the input string were consumed.
 /// status receives one of the demangle_ enum entries above if it's not nullptr.
 /// Flags controls various details of the demangled representation.
-char *microsoftDemangle(const char *mangled_name, size_t *n_read, int *status,
-MSDemangleFlags Flags = MSDF_None);
+char *microsoftDemangle(std::string_view mangled_name, size_t *n_read,
+int *status, MSDemangleFlags Flags = MSDF_None);
 
 // Demangles a Rust v0 mangled symbol.
 char *rustDemangle(std::string_view MangledName);
Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -107,7 +107,7 @@
 }
 
 // Local helpers for different demangling implementations.
-static char *GetMSVCDemangledStr(const char *M) {
+static char *GetMSVCDemangledStr(std::string_view M) {
   char *demangled_cstr = llvm::microsoftDemangle(
   M, nullptr, nullptr,
   llvm::MSDemangleFlags(
@@ -116,9 +116,9 @@
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
-  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
+  LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M.data(), demangled_cstr);
 else
-  LLDB_LOGF(log, "demangled msvc: %s -> error", M);
+  LLDB_LOGF(log, "demangled msvc: %s -> error", M.data());
   }
 
   return demangled_cstr;
@@ -204,7 +204,7 @@
 // We have no rich mangling for MSVC-mangled names yet, so first try to
 // demangle it if necessary.
 if (!m_demangled && !m_mangled.GetMangledCounterpart(

[Lldb-commits] [lldb] 8a46369 - [lldb][NFCI] ConstString methods should take StringRefs by value

2023-06-05 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-06-05T13:06:58-07:00
New Revision: 8a4636929fd649d4311fadb03c6e4be4fefec3af

URL: 
https://github.com/llvm/llvm-project/commit/8a4636929fd649d4311fadb03c6e4be4fefec3af
DIFF: 
https://github.com/llvm/llvm-project/commit/8a4636929fd649d4311fadb03c6e4be4fefec3af.diff

LOG: [lldb][NFCI] ConstString methods should take StringRefs by value

StringRef was made to be passed by value efficiently.

Differential Revision: https://reviews.llvm.org/D152010

Added: 


Modified: 
lldb/include/lldb/Utility/ConstString.h
lldb/source/Utility/ConstString.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ConstString.h 
b/lldb/include/lldb/Utility/ConstString.h
index 332cca5fdbf12..c23c6fd3546e5 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -44,7 +44,7 @@ class ConstString {
   /// Initializes the string to an empty string.
   ConstString() = default;
 
-  explicit ConstString(const llvm::StringRef &s);
+  explicit ConstString(llvm::StringRef s);
 
   /// Construct with C String value
   ///
@@ -328,7 +328,7 @@ class ConstString {
   /// A NULL terminated C string to add to the string pool.
   void SetCString(const char *cstr);
 
-  void SetString(const llvm::StringRef &s);
+  void SetString(llvm::StringRef s);
 
   /// Set the C string value and its mangled counterpart.
   ///

diff  --git a/lldb/source/Utility/ConstString.cpp 
b/lldb/source/Utility/ConstString.cpp
index 7b084769e1ffb..4535771adfb73 100644
--- a/lldb/source/Utility/ConstString.cpp
+++ b/lldb/source/Utility/ConstString.cpp
@@ -98,7 +98,7 @@ class Pool {
 return nullptr;
   }
 
-  const char *GetConstCStringWithStringRef(const llvm::StringRef &string_ref) {
+  const char *GetConstCStringWithStringRef(llvm::StringRef string_ref) {
 if (string_ref.data()) {
   const uint8_t h = hash(string_ref);
 
@@ -171,7 +171,7 @@ class Pool {
   }
 
 protected:
-  uint8_t hash(const llvm::StringRef &s) const {
+  uint8_t hash(llvm::StringRef s) const {
 uint32_t h = llvm::djbHash(s);
 return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff;
   }
@@ -208,7 +208,7 @@ ConstString::ConstString(const char *cstr)
 ConstString::ConstString(const char *cstr, size_t cstr_len)
 : m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {}
 
-ConstString::ConstString(const llvm::StringRef &s)
+ConstString::ConstString(llvm::StringRef s)
 : m_string(StringPool().GetConstCStringWithStringRef(s)) {}
 
 bool ConstString::operator<(ConstString rhs) const {
@@ -302,8 +302,8 @@ void ConstString::SetCString(const char *cstr) {
   m_string = StringPool().GetConstCString(cstr);
 }
 
-void ConstString::SetString(const llvm::StringRef &s) {
-  m_string = StringPool().GetConstCStringWithLength(s.data(), s.size());
+void ConstString::SetString(llvm::StringRef s) {
+  m_string = StringPool().GetConstCStringWithStringRef(s);
 }
 
 void ConstString::SetStringWithMangledCounterpart(llvm::StringRef demangled,



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152010: [lldb][NFCI] ConstString methods should take StringRefs by value

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a4636929fd6: [lldb][NFCI] ConstString methods should take 
StringRefs by value (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152010/new/

https://reviews.llvm.org/D152010

Files:
  lldb/include/lldb/Utility/ConstString.h
  lldb/source/Utility/ConstString.cpp


Index: lldb/source/Utility/ConstString.cpp
===
--- lldb/source/Utility/ConstString.cpp
+++ lldb/source/Utility/ConstString.cpp
@@ -98,7 +98,7 @@
 return nullptr;
   }
 
-  const char *GetConstCStringWithStringRef(const llvm::StringRef &string_ref) {
+  const char *GetConstCStringWithStringRef(llvm::StringRef string_ref) {
 if (string_ref.data()) {
   const uint8_t h = hash(string_ref);
 
@@ -171,7 +171,7 @@
   }
 
 protected:
-  uint8_t hash(const llvm::StringRef &s) const {
+  uint8_t hash(llvm::StringRef s) const {
 uint32_t h = llvm::djbHash(s);
 return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff;
   }
@@ -208,7 +208,7 @@
 ConstString::ConstString(const char *cstr, size_t cstr_len)
 : m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {}
 
-ConstString::ConstString(const llvm::StringRef &s)
+ConstString::ConstString(llvm::StringRef s)
 : m_string(StringPool().GetConstCStringWithStringRef(s)) {}
 
 bool ConstString::operator<(ConstString rhs) const {
@@ -302,8 +302,8 @@
   m_string = StringPool().GetConstCString(cstr);
 }
 
-void ConstString::SetString(const llvm::StringRef &s) {
-  m_string = StringPool().GetConstCStringWithLength(s.data(), s.size());
+void ConstString::SetString(llvm::StringRef s) {
+  m_string = StringPool().GetConstCStringWithStringRef(s);
 }
 
 void ConstString::SetStringWithMangledCounterpart(llvm::StringRef demangled,
Index: lldb/include/lldb/Utility/ConstString.h
===
--- lldb/include/lldb/Utility/ConstString.h
+++ lldb/include/lldb/Utility/ConstString.h
@@ -44,7 +44,7 @@
   /// Initializes the string to an empty string.
   ConstString() = default;
 
-  explicit ConstString(const llvm::StringRef &s);
+  explicit ConstString(llvm::StringRef s);
 
   /// Construct with C String value
   ///
@@ -328,7 +328,7 @@
   /// A NULL terminated C string to add to the string pool.
   void SetCString(const char *cstr);
 
-  void SetString(const llvm::StringRef &s);
+  void SetString(llvm::StringRef s);
 
   /// Set the C string value and its mangled counterpart.
   ///


Index: lldb/source/Utility/ConstString.cpp
===
--- lldb/source/Utility/ConstString.cpp
+++ lldb/source/Utility/ConstString.cpp
@@ -98,7 +98,7 @@
 return nullptr;
   }
 
-  const char *GetConstCStringWithStringRef(const llvm::StringRef &string_ref) {
+  const char *GetConstCStringWithStringRef(llvm::StringRef string_ref) {
 if (string_ref.data()) {
   const uint8_t h = hash(string_ref);
 
@@ -171,7 +171,7 @@
   }
 
 protected:
-  uint8_t hash(const llvm::StringRef &s) const {
+  uint8_t hash(llvm::StringRef s) const {
 uint32_t h = llvm::djbHash(s);
 return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff;
   }
@@ -208,7 +208,7 @@
 ConstString::ConstString(const char *cstr, size_t cstr_len)
 : m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {}
 
-ConstString::ConstString(const llvm::StringRef &s)
+ConstString::ConstString(llvm::StringRef s)
 : m_string(StringPool().GetConstCStringWithStringRef(s)) {}
 
 bool ConstString::operator<(ConstString rhs) const {
@@ -302,8 +302,8 @@
   m_string = StringPool().GetConstCString(cstr);
 }
 
-void ConstString::SetString(const llvm::StringRef &s) {
-  m_string = StringPool().GetConstCStringWithLength(s.data(), s.size());
+void ConstString::SetString(llvm::StringRef s) {
+  m_string = StringPool().GetConstCStringWithStringRef(s);
 }
 
 void ConstString::SetStringWithMangledCounterpart(llvm::StringRef demangled,
Index: lldb/include/lldb/Utility/ConstString.h
===
--- lldb/include/lldb/Utility/ConstString.h
+++ lldb/include/lldb/Utility/ConstString.h
@@ -44,7 +44,7 @@
   /// Initializes the string to an empty string.
   ConstString() = default;
 
-  explicit ConstString(const llvm::StringRef &s);
+  explicit ConstString(llvm::StringRef s);
 
   /// Construct with C String value
   ///
@@ -328,7 +328,7 @@
   /// A NULL terminated C string to add to the string pool.
   void SetCString(const char *cstr);
 
-  void SetString(const llvm::StringRef &s);
+  void SetString(llvm::StringRef s);
 
   /// Set the C string value and its mangled counterpart.
   ///
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152013: [lldb/Commands] Fix disk completion from root directory

2023-06-05 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 528560.
mib marked an inline comment as done.
mib added a comment.

Address @bulbazord comments!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152013/new/

https://reviews.llvm.org/D152013

Files:
  lldb/source/Commands/CommandCompletions.cpp
  lldb/test/API/functionalities/completion/TestCompletion.py


Index: lldb/test/API/functionalities/completion/TestCompletion.py
===
--- lldb/test/API/functionalities/completion/TestCompletion.py
+++ lldb/test/API/functionalities/completion/TestCompletion.py
@@ -477,6 +477,19 @@
 self.complete_from_to("my_test_cmd main.cp", ["main.cpp"])
 self.expect("my_test_cmd main.cpp", substrs=["main.cpp"])
 
+def test_completion_target_create_from_root_dir(self):
+"""Tests source file completion by completing ."""
+root_dir = os.path.abspath(os.sep)
+self.completions_contain(
+"target create " + root_dir,
+list(
+filter(
+lambda x: os.path.exists(x),
+map(lambda x: root_dir + x + os.sep, os.listdir(root_dir)),
+)
+),
+)
+
 def test_target_modules_load_aout(self):
 """Tests modules completion by completing the target modules load 
argument."""
 self.build()
Index: lldb/source/Commands/CommandCompletions.cpp
===
--- lldb/source/Commands/CommandCompletions.cpp
+++ lldb/source/Commands/CommandCompletions.cpp
@@ -381,6 +381,8 @@
   Storage.append(RemainderDir);
 }
 SearchDir = Storage;
+  } else if (CompletionBuffer == path::root_directory(CompletionBuffer)) {
+SearchDir = CompletionBuffer;
   } else {
 SearchDir = path::parent_path(CompletionBuffer);
   }
@@ -390,9 +392,11 @@
   PartialItem = path::filename(CompletionBuffer);
 
   // path::filename() will return "." when the passed path ends with a
-  // directory separator. We have to filter those out, but only when the
-  // "." doesn't come from the completion request itself.
-  if (PartialItem == "." && path::is_separator(CompletionBuffer.back()))
+  // directory separator or the separator when passed the disk root directory.
+  // We have to filter those out, but only when the "." doesn't come from the
+  // completion request itself.
+  if ((PartialItem == "." || PartialItem == path::get_separator()) &&
+  path::is_separator(CompletionBuffer.back()))
 PartialItem = llvm::StringRef();
 
   if (SearchDir.empty()) {


Index: lldb/test/API/functionalities/completion/TestCompletion.py
===
--- lldb/test/API/functionalities/completion/TestCompletion.py
+++ lldb/test/API/functionalities/completion/TestCompletion.py
@@ -477,6 +477,19 @@
 self.complete_from_to("my_test_cmd main.cp", ["main.cpp"])
 self.expect("my_test_cmd main.cpp", substrs=["main.cpp"])
 
+def test_completion_target_create_from_root_dir(self):
+"""Tests source file completion by completing ."""
+root_dir = os.path.abspath(os.sep)
+self.completions_contain(
+"target create " + root_dir,
+list(
+filter(
+lambda x: os.path.exists(x),
+map(lambda x: root_dir + x + os.sep, os.listdir(root_dir)),
+)
+),
+)
+
 def test_target_modules_load_aout(self):
 """Tests modules completion by completing the target modules load argument."""
 self.build()
Index: lldb/source/Commands/CommandCompletions.cpp
===
--- lldb/source/Commands/CommandCompletions.cpp
+++ lldb/source/Commands/CommandCompletions.cpp
@@ -381,6 +381,8 @@
   Storage.append(RemainderDir);
 }
 SearchDir = Storage;
+  } else if (CompletionBuffer == path::root_directory(CompletionBuffer)) {
+SearchDir = CompletionBuffer;
   } else {
 SearchDir = path::parent_path(CompletionBuffer);
   }
@@ -390,9 +392,11 @@
   PartialItem = path::filename(CompletionBuffer);
 
   // path::filename() will return "." when the passed path ends with a
-  // directory separator. We have to filter those out, but only when the
-  // "." doesn't come from the completion request itself.
-  if (PartialItem == "." && path::is_separator(CompletionBuffer.back()))
+  // directory separator or the separator when passed the disk root directory.
+  // We have to filter those out, but only when the "." doesn't come from the
+  // completion request itself.
+  if ((PartialItem == "." || PartialItem == path::get_separator()) &&
+  path::is_separator(CompletionBuffer.back()))
 PartialItem = llvm::StringRef();
 
   if (SearchDir.empty()) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org

[Lldb-commits] [PATCH] D152013: [lldb/Commands] Fix disk completion from root directory

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

Ok, this looks fine to me. I'm not 100% sure this will work on Windows, but we 
neither Ismail nor I have windows machines to test this on. Watch the windows 
bots please.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152013/new/

https://reviews.llvm.org/D152013

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152011: [lldb/Commands] Add support to auto-completion for user commands

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

Thanks for adding the test! Most of this change looks fairly mechanical so I 
think this is probably good to go.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152011/new/

https://reviews.llvm.org/D152011

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 59af0c3 - [lldb][NFCI] Change the way Process stores StructuredData plugins

2023-06-05 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-06-05T13:49:58-07:00
New Revision: 59af0c38956346ece6e89276ec7ca99683010b2a

URL: 
https://github.com/llvm/llvm-project/commit/59af0c38956346ece6e89276ec7ca99683010b2a
DIFF: 
https://github.com/llvm/llvm-project/commit/59af0c38956346ece6e89276ec7ca99683010b2a.diff

LOG: [lldb][NFCI] Change the way Process stores StructuredData plugins

Instead of having a map from ConstString to StructuredDataPluginSP, we
can use an llvm::StringMap. The keys themselves don't need to be
ConstStrings, so an llvm::StringMap feels most natural.

Differential Revision: https://reviews.llvm.org/D151960

Added: 


Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index d565931af7087..b27fd212ad1f9 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2561,7 +2561,7 @@ void PruneThreadPlans();
   /// The plugin if one is available for the specified feature;
   /// otherwise, returns an empty shared pointer.
   lldb::StructuredDataPluginSP
-  GetStructuredDataPlugin(ConstString type_name) const;
+  GetStructuredDataPlugin(llvm::StringRef type_name) const;
 
   virtual void *GetImplementation() { return nullptr; }
 
@@ -2908,9 +2908,6 @@ void PruneThreadPlans();
 }
   };
 
-  using StructuredDataPluginMap =
-  std::map;
-
   // Member variables
   std::weak_ptr m_target_wp; ///< The target that owns this process.
   lldb::pid_t m_pid = LLDB_INVALID_PROCESS_ID;
@@ -3033,7 +3030,7 @@ void PruneThreadPlans();
// don't support the ability to modify
// the stack.
   std::mutex m_run_thread_plan_lock;
-  StructuredDataPluginMap m_structured_data_plugin_map;
+  llvm::StringMap m_structured_data_plugin_map;
 
   enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit;
 

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 572b73871760c..3dd807aa83632 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -4301,7 +4301,7 @@ void Process::BroadcastStructuredData(const 
StructuredData::ObjectSP &object_sp,
 }
 
 StructuredDataPluginSP
-Process::GetStructuredDataPlugin(ConstString type_name) const {
+Process::GetStructuredDataPlugin(llvm::StringRef type_name) const {
   auto find_it = m_structured_data_plugin_map.find(type_name);
   if (find_it != m_structured_data_plugin_map.end())
 return find_it->second;
@@ -5782,7 +5782,7 @@ void Process::ModulesDidLoad(ModuleList &module_list) {
 LoadOperatingSystemPlugin(false);
 
   // Inform the structured-data plugins of the modified modules.
-  for (auto pair : m_structured_data_plugin_map) {
+  for (auto &pair : m_structured_data_plugin_map) {
 if (pair.second)
   pair.second->ModulesDidLoad(*this, module_list);
   }
@@ -5977,34 +5977,29 @@ void Process::MapSupportedStructuredDataPlugins(
 
   // Bail out early if there are no type names to map.
   if (supported_type_names.GetSize() == 0) {
-LLDB_LOGF(log, "Process::%s(): no structured data types supported",
-  __FUNCTION__);
+LLDB_LOG(log, "no structured data types supported");
 return;
   }
 
-  // Convert StructuredData type names to ConstString instances.
-  std::set const_type_names;
+  // These StringRefs are backed by the input parameter.
+  std::set type_names;
 
-  LLDB_LOGF(log,
-"Process::%s(): the process supports the following async "
-"structured data types:",
-__FUNCTION__);
+  LLDB_LOG(log,
+   "the process supports the following async structured data types:");
 
   supported_type_names.ForEach(
-  [&const_type_names, &log](StructuredData::Object *object) {
-if (!object) {
-  // Invalid - shouldn't be null objects in the array.
+  [&type_names, &log](StructuredData::Object *object) {
+// There shouldn't be null objects in the array.
+if (!object)
   return false;
-}
 
-auto type_name = object->GetAsString();
-if (!type_name) {
-  // Invalid format - all type names should be strings.
+// All type names should be strings.
+const llvm::StringRef type_name = object->GetStringValue();
+if (type_name.empty())
   return false;
-}
 
-const_type_names.insert(ConstString(type_name->GetValue()));
-LLDB_LOG(log, "- {0}", type_name->GetValue());
+type_names.insert(type_name);
+LLDB_LOG(log, "- {0}", type_name);
 return true;
   });
 
@@ -6013,10 +6008,10 @@ void Process::MapSupportedStructuredDataPlugins(
   // we've consumed all the type names.
   // FIXME: should we return an error if there are type names nobody
   // supports?
-  for (uint32_t plugi

[Lldb-commits] [PATCH] D151960: [lldb][NFCI] Change the way Process stores StructuredData plugins

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG59af0c389563: [lldb][NFCI] Change the way Process stores 
StructuredData plugins (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151960/new/

https://reviews.llvm.org/D151960

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Target/Process.cpp

Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -4301,7 +4301,7 @@
 }
 
 StructuredDataPluginSP
-Process::GetStructuredDataPlugin(ConstString type_name) const {
+Process::GetStructuredDataPlugin(llvm::StringRef type_name) const {
   auto find_it = m_structured_data_plugin_map.find(type_name);
   if (find_it != m_structured_data_plugin_map.end())
 return find_it->second;
@@ -5782,7 +5782,7 @@
 LoadOperatingSystemPlugin(false);
 
   // Inform the structured-data plugins of the modified modules.
-  for (auto pair : m_structured_data_plugin_map) {
+  for (auto &pair : m_structured_data_plugin_map) {
 if (pair.second)
   pair.second->ModulesDidLoad(*this, module_list);
   }
@@ -5977,34 +5977,29 @@
 
   // Bail out early if there are no type names to map.
   if (supported_type_names.GetSize() == 0) {
-LLDB_LOGF(log, "Process::%s(): no structured data types supported",
-  __FUNCTION__);
+LLDB_LOG(log, "no structured data types supported");
 return;
   }
 
-  // Convert StructuredData type names to ConstString instances.
-  std::set const_type_names;
+  // These StringRefs are backed by the input parameter.
+  std::set type_names;
 
-  LLDB_LOGF(log,
-"Process::%s(): the process supports the following async "
-"structured data types:",
-__FUNCTION__);
+  LLDB_LOG(log,
+   "the process supports the following async structured data types:");
 
   supported_type_names.ForEach(
-  [&const_type_names, &log](StructuredData::Object *object) {
-if (!object) {
-  // Invalid - shouldn't be null objects in the array.
+  [&type_names, &log](StructuredData::Object *object) {
+// There shouldn't be null objects in the array.
+if (!object)
   return false;
-}
 
-auto type_name = object->GetAsString();
-if (!type_name) {
-  // Invalid format - all type names should be strings.
+// All type names should be strings.
+const llvm::StringRef type_name = object->GetStringValue();
+if (type_name.empty())
   return false;
-}
 
-const_type_names.insert(ConstString(type_name->GetValue()));
-LLDB_LOG(log, "- {0}", type_name->GetValue());
+type_names.insert(type_name);
+LLDB_LOG(log, "- {0}", type_name);
 return true;
   });
 
@@ -6013,10 +6008,10 @@
   // we've consumed all the type names.
   // FIXME: should we return an error if there are type names nobody
   // supports?
-  for (uint32_t plugin_index = 0; !const_type_names.empty(); plugin_index++) {
+  for (uint32_t plugin_index = 0; !type_names.empty(); plugin_index++) {
 auto create_instance =
-   PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(
-   plugin_index);
+PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(
+plugin_index);
 if (!create_instance)
   break;
 
@@ -6029,9 +6024,9 @@
 }
 
 // For any of the remaining type names, map any that this plugin supports.
-std::vector names_to_remove;
-for (auto &type_name : const_type_names) {
-  if (plugin_sp->SupportsStructuredDataType(type_name)) {
+std::vector names_to_remove;
+for (llvm::StringRef type_name : type_names) {
+  if (plugin_sp->SupportsStructuredDataType(ConstString(type_name))) {
 m_structured_data_plugin_map.insert(
 std::make_pair(type_name, plugin_sp));
 names_to_remove.push_back(type_name);
@@ -6041,8 +6036,8 @@
 }
 
 // Remove the type names that were consumed by this plugin.
-for (auto &type_name : names_to_remove)
-  const_type_names.erase(type_name);
+for (llvm::StringRef type_name : names_to_remove)
+  type_names.erase(type_name);
   }
 }
 
@@ -6059,7 +6054,7 @@
 return false;
 
   // Grab the async structured type name (i.e. the feature/plugin name).
-  ConstString type_name;
+  llvm::StringRef type_name;
   if (!dictionary->GetValueForKeyAsString("type", type_name))
 return false;
 
@@ -6071,7 +6066,8 @@
   }
 
   // Route the structured data to the plugin.
-  find_it->second->HandleArrivalOfStructuredData(*this, type_name, object_sp);
+  find_it->second->HandleArrivalOfStructuredData(*this, ConstString(type_name),
+ object_sp);
   return true;
 }
 
Index: lldb/include/lldb/Target/Process.h
==

[Lldb-commits] [PATCH] D151003: [Damangle] convert dlangDemangle to use std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

> [Damangle]

Damangle? dAmangle? *sigh*


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151003/new/

https://reviews.llvm.org/D151003

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152176: [Demangle] convert microsoftDemangle to take a std::string_view

2023-06-05 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

This patch should have fixed the callsite in `llvm::demangle`...I will fix that 
up in D149104  which I am actively rebasing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152176/new/

https://reviews.llvm.org/D152176

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152189: [LLDB][PDB] Fix age field in UUID in PDB file.

2023-06-05 Thread Reid Kleckner via Phabricator via lldb-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Wow. Well, I'm not going to argue otherwise. :)

lgtm


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152189/new/

https://reviews.llvm.org/D152189

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151950: [lldb] Unconditionally increment depth when printing children

2023-06-05 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Is ity possible to test this with a nested C++ type?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151950/new/

https://reviews.llvm.org/D151950

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151950: [lldb] Unconditionally increment depth when printing children

2023-06-05 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

+1 to a test

thanks for the fix!




Comment at: lldb/source/DataFormatters/ValueObjectPrinter.cpp:593
 const DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
-  const uint32_t consumed_depth = (!m_options.m_pointer_as_array) ? 1 : 0;
+  const uint32_t consumed_depth = m_options.m_pointer_as_array ? 0 : 1;
   const bool does_consume_ptr_depth =

seems this is now used with `m_omit_summary_depth`, maybe name it 
`consumed_summary_depth`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151950/new/

https://reviews.llvm.org/D151950

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152210: [lldb][NFCI] Remove use of ConstString from OptionValueProperties

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jingham, jasonmolenda, fdeazeve.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

In the interest of keeping the ConstString StringPool small, this patch
aims to remove the use of ConstString from OptionValueProperties.

We can maintain quick lookups by using an llvm::StringMap to find the
correct index by name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152210

Files:
  lldb/include/lldb/Interpreter/OptionValue.h
  lldb/include/lldb/Interpreter/OptionValueProperties.h
  lldb/source/Interpreter/OptionValueProperties.cpp

Index: lldb/source/Interpreter/OptionValueProperties.cpp
===
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -20,18 +20,17 @@
 using namespace lldb;
 using namespace lldb_private;
 
-OptionValueProperties::OptionValueProperties(ConstString name) : m_name(name) {}
+OptionValueProperties::OptionValueProperties(llvm::StringRef name)
+: m_name(name.str()) {}
 
 void OptionValueProperties::Initialize(const PropertyDefinitions &defs) {
   for (const auto &definition : defs) {
 Property property(definition);
 assert(property.IsValid());
-m_name_to_index.Append(ConstString(property.GetName()),
-   m_properties.size());
+m_name_to_index.insert({property.GetName(), m_properties.size()});
 property.GetValue()->SetParent(shared_from_this());
 m_properties.push_back(property);
   }
-  m_name_to_index.Sort();
 }
 
 void OptionValueProperties::SetValueChangedCallback(
@@ -41,24 +40,25 @@
 property->SetValueChangedCallback(std::move(callback));
 }
 
-void OptionValueProperties::AppendProperty(ConstString name,
+void OptionValueProperties::AppendProperty(llvm::StringRef name,
llvm::StringRef desc, bool is_global,
const OptionValueSP &value_sp) {
-  Property property(name.GetStringRef(), desc, is_global, value_sp);
-  m_name_to_index.Append(name, m_properties.size());
+  Property property(name, desc, is_global, value_sp);
+  m_name_to_index.insert({name, m_properties.size()});
   m_properties.push_back(property);
   value_sp->SetParent(shared_from_this());
-  m_name_to_index.Sort();
 }
 
 lldb::OptionValueSP
 OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx,
-  ConstString key) const {
-  lldb::OptionValueSP value_sp;
-  size_t idx = m_name_to_index.Find(key, SIZE_MAX);
-  if (idx < m_properties.size())
-value_sp = GetPropertyAtIndex(idx, exe_ctx)->GetValue();
-  return value_sp;
+  llvm::StringRef key) const {
+  auto iter = m_name_to_index.find(key);
+  if (iter == m_name_to_index.end())
+return OptionValueSP();
+  const size_t idx = iter->second;
+  if (idx >= m_properties.size())
+return OptionValueSP();
+  return GetPropertyAtIndex(idx, exe_ctx)->GetValue();
 }
 
 lldb::OptionValueSP
@@ -69,13 +69,13 @@
 return OptionValueSP();
 
   llvm::StringRef sub_name;
-  ConstString key;
+  llvm::StringRef key;
   size_t key_len = name.find_first_of(".[{");
   if (key_len != llvm::StringRef::npos) {
-key.SetString(name.take_front(key_len));
+key = name.take_front(key_len);
 sub_name = name.drop_front(key_len);
   } else
-key.SetString(name);
+key = name;
 
   value_sp = GetValueForKey(exe_ctx, key);
   if (sub_name.empty() || !value_sp)
@@ -138,14 +138,20 @@
   return error;
 }
 
-size_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
-  return m_name_to_index.Find(name, SIZE_MAX);
+size_t OptionValueProperties::GetPropertyIndex(llvm::StringRef name) const {
+  auto iter = m_name_to_index.find(name);
+  if (iter == m_name_to_index.end())
+return SIZE_MAX;
+  return iter->second;
 }
 
 const Property *
-OptionValueProperties::GetProperty(ConstString name,
+OptionValueProperties::GetProperty(llvm::StringRef name,
const ExecutionContext *exe_ctx) const {
-  return GetPropertyAtIndex(m_name_to_index.Find(name, SIZE_MAX), exe_ctx);
+  auto iter = m_name_to_index.find(name);
+  if (iter == m_name_to_index.end())
+return nullptr;
+  return GetPropertyAtIndex(iter->second, exe_ctx);
 }
 
 lldb::OptionValueSP OptionValueProperties::GetPropertyValueAtIndex(
@@ -399,18 +405,19 @@
 const Property *
 OptionValueProperties::GetPropertyAtPath(const ExecutionContext *exe_ctx,
  llvm::StringRef name) const {
-  const Property *property = nullptr;
   if (name.empty())
 return nullptr;
+
+  const Property *property = nullptr;
   llvm::StringRef sub_name;
-  ConstString key;
+  llvm::StringRef key;
   size_t key_len = name.find_first_of(".

[Lldb-commits] [PATCH] D152220: [lldb][NFCI] Change type of Broadcaster's name

2023-06-05 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Broadcasters don't need their names in the StringPool. It doesn't
benefit from fast comparisons and doesn't benefit from uniqueness.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152220

Files:
  lldb/include/lldb/Utility/Broadcaster.h
  lldb/source/API/SBBroadcaster.cpp
  lldb/source/Core/ThreadedCommunication.cpp
  lldb/source/Utility/Broadcaster.cpp
  lldb/source/Utility/Event.cpp
  lldb/source/Utility/Listener.cpp

Index: lldb/source/Utility/Listener.cpp
===
--- lldb/source/Utility/Listener.cpp
+++ lldb/source/Utility/Listener.cpp
@@ -234,7 +234,7 @@
 
 if (m_broadcaster_names) {
   bool found_source = false;
-  ConstString event_broadcaster_name =
+  const llvm::StringRef event_broadcaster_name =
   event_sp->GetBroadcaster()->GetBroadcasterName();
   for (uint32_t i = 0; i < m_num_broadcaster_names; ++i) {
 if (m_broadcaster_names[i] == event_broadcaster_name) {
Index: lldb/source/Utility/Event.cpp
===
--- lldb/source/Utility/Event.cpp
+++ lldb/source/Utility/Event.cpp
@@ -58,13 +58,13 @@
   s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x (%s), data = ",
 static_cast(this),
 static_cast(broadcaster),
-broadcaster->GetBroadcasterName().GetCString(), m_type,
+broadcaster->GetBroadcasterName().c_str(), m_type,
 event_name.GetData());
 else
   s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x, data = ",
 static_cast(this),
 static_cast(broadcaster),
-broadcaster->GetBroadcasterName().GetCString(), m_type);
+broadcaster->GetBroadcasterName().c_str(), m_type);
   } else
 s->Printf("%p Event: broadcaster = NULL, type = 0x%8.8x, data = ",
   static_cast(this), m_type);
Index: lldb/source/Utility/Broadcaster.cpp
===
--- lldb/source/Utility/Broadcaster.cpp
+++ lldb/source/Utility/Broadcaster.cpp
@@ -23,9 +23,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
-Broadcaster::Broadcaster(BroadcasterManagerSP manager_sp, const char *name)
+Broadcaster::Broadcaster(BroadcasterManagerSP manager_sp, llvm::StringRef name)
 : m_broadcaster_sp(std::make_shared(*this)),
-  m_manager_sp(std::move(manager_sp)), m_broadcaster_name(name) {
+  m_manager_sp(std::move(manager_sp)), m_broadcaster_name(name.str()) {
   Log *log = GetLog(LLDBLog::Object);
   LLDB_LOG(log, "{0} Broadcaster::Broadcaster(\"{1}\")",
static_cast(this), GetBroadcasterName());
Index: lldb/source/Core/ThreadedCommunication.cpp
===
--- lldb/source/Core/ThreadedCommunication.cpp
+++ lldb/source/Core/ThreadedCommunication.cpp
@@ -57,7 +57,7 @@
 ThreadedCommunication::~ThreadedCommunication() {
   LLDB_LOG(GetLog(LLDBLog::Object | LLDBLog::Communication),
"{0} ThreadedCommunication::~ThreadedCommunication (name = {1})",
-   this, GetBroadcasterName().AsCString());
+   this, GetBroadcasterName());
 }
 
 void ThreadedCommunication::Clear() {
Index: lldb/source/API/SBBroadcaster.cpp
===
--- lldb/source/API/SBBroadcaster.cpp
+++ lldb/source/API/SBBroadcaster.cpp
@@ -92,7 +92,7 @@
   LLDB_INSTRUMENT_VA(this);
 
   if (m_opaque_ptr)
-return m_opaque_ptr->GetBroadcasterName().GetCString();
+return ConstString(m_opaque_ptr->GetBroadcasterName()).GetCString();
   return nullptr;
 }
 
Index: lldb/include/lldb/Utility/Broadcaster.h
===
--- lldb/include/lldb/Utility/Broadcaster.h
+++ lldb/include/lldb/Utility/Broadcaster.h
@@ -149,10 +149,12 @@
 public:
   /// Construct with a broadcaster with a name.
   ///
+  /// \param[in] manager_sp
+  ///   A shared pointer to the BroadcasterManager that will manage this
+  ///   broadcaster.
   /// \param[in] name
-  /// A NULL terminated C string that contains the name of the
-  /// broadcaster object.
-  Broadcaster(lldb::BroadcasterManagerSP manager_sp, const char *name);
+  ///   A StringRef of the name that this broadcaster will have.
+  Broadcaster(lldb::BroadcasterManagerSP manager_sp, llvm::StringRef name);
 
   /// Destructor.
   ///
@@ -213,11 +215,12 @@
 return m_broadcaster_sp->AddListener(listener_sp, event_mask);
   }
 
-  /// Get the NULL terminated C string name of this Broadcaster object.
+  /// Get this broadcaster's name.
   ///
   /// \return
-  /// The NULL terminated C string 

[Lldb-commits] [PATCH] D152011: [lldb/Commands] Add support to auto-completion for user commands

2023-06-05 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/lldb-enumerations.h:1279
+  // if you & in this bit the base code will not process the option.
+  eCustomCompletion = (1u << 24)
+};

Should this be `<< 25`? 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152011/new/

https://reviews.llvm.org/D152011

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D150805: Rate limit progress reporting

2023-06-05 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

In D150805#4350849 , @JDevlieghere 
wrote:

> I also like Jordan's rate limiting idea. In my mind that should be a property 
> of the broadcaster. Different tools (e.g. vscode vs the command line) could 
> specify different values when register a listener.

This makes sense: we could augment `lldb_private::Listener` with additional 
members that keep track of when the last broadcast time was, and if we're rate 
limiting. Then we could change the implementation of 
`Listener::GetEvent(lldb::EventSP &event_sp, const Timeout 
&timeout)` to continuously churn through `m_events`, returning the most recent 
one by the time the rate limiting window is over, and discarding any 
intermediate ones in between.

One thing I'm not sure of though is how we'll avoid an unnecessary pause for 
rate limiting on the last item. This patch avoids that because it checks 
`data->GetCompleted() != data->GetTotal()` to decide if we should actually rate 
limit. In the generic case, how does the listener know that an event it returns 
is the final one, and that it should ignore the rate limiting delay?

I think we could address that by adding a `bool m_important` member to 
`lldb::Event`, and then it would be up to the broadcaster to set that to true 
for the last one (or any intermediate ones that are similarly important & 
should be immediately shown, e.g. warnings/errors). Would that be reasonable?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150805/new/

https://reviews.llvm.org/D150805

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152225: [lldb] mark `clang_resource_path` as static

2023-06-05 Thread Junchang Liu via Phabricator via lldb-commits
paperchalice created this revision.
paperchalice added a reviewer: aprantl.
Herald added a project: All.
paperchalice requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The lifetime of `clang_resource_path` should be same as `kResourceDirSuffixes`, 
because `kResourceDirSuffixes` doesn't own `clang_resource_path`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152225

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -52,7 +52,7 @@
   Log *log = GetLog(LLDBLog::Host);
   std::string raw_path = lldb_shlib_spec.GetPath();
   llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
-  const std::string clang_resource_path =
+  static const std::string clang_resource_path =
   clang::driver::Driver::GetResourcesPath("bin/lldb", CLANG_RESOURCE_DIR);
 
   static const llvm::StringRef kResourceDirSuffixes[] = {


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -52,7 +52,7 @@
   Log *log = GetLog(LLDBLog::Host);
   std::string raw_path = lldb_shlib_spec.GetPath();
   llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
-  const std::string clang_resource_path =
+  static const std::string clang_resource_path =
   clang::driver::Driver::GetResourcesPath("bin/lldb", CLANG_RESOURCE_DIR);
 
   static const llvm::StringRef kResourceDirSuffixes[] = {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

2023-06-05 Thread Joachim Protze via Phabricator via lldb-commits
protze.joachim reopened this revision.
protze.joachim added a comment.
This revision is now accepted and ready to land.

The review should not be closed, since the patch was reverted and should be 
recommitted (this time possibly with a reference to this review?)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141907/new/

https://reviews.llvm.org/D141907

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

2023-06-05 Thread Junchang Liu via Phabricator via lldb-commits
paperchalice added a comment.

In D141907#4398196 , @protze.joachim 
wrote:

> The review should not be closed, since the patch was reverted and should be 
> recommitted (this time possibly with a reference to this review?)

This is recommitted as 0beffb854209a41f31beb18f9631258349a99299 
, but 
break some lldb builds, so I created https://reviews.llvm.org/D152225 .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141907/new/

https://reviews.llvm.org/D141907

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits