[Lldb-commits] [lldb] [lldb] Fix build break on windows (PR #84863)

2024-03-11 Thread Luke Weiler via lldb-commits

https://github.com/lwmaia edited https://github.com/llvm/llvm-project/pull/84863
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Fix build break on windows (PR #84863)

2024-03-11 Thread Luke Weiler via lldb-commits

https://github.com/lwmaia created 
https://github.com/llvm/llvm-project/pull/84863

This is a one line fix for a Windows specific (I believe) build break.

The build failure looks like this:
`D:\a\_work\1\s\lldb\source\Symbol\Symtab.cpp(128): error C2440: 
'': cannot convert from 'lldb_private::ConstString' to 
'llvm::StringRef'
D:\a\_work\1\s\lldb\source\Symbol\Symtab.cpp(128): note: 
'llvm::StringRef::StringRef': ambiguous call to overloaded function
D:\a\_work\1\s\llvm\include\llvm/ADT/StringRef.h(840): note: could be 
'llvm::StringRef::StringRef(llvm::StringRef &&)'
D:\a\_work\1\s\llvm\include\llvm/ADT/StringRef.h(104): note: or   
'llvm::StringRef::StringRef(std::string_view)'
D:\a\_work\1\s\lldb\source\Symbol\Symtab.cpp(128): note: while trying to match 
the argument list '(lldb_private::ConstString)'
D:\a\_work\1\s\lldb\source\Symbol\Symtab.cpp(128): error C2672: 
'std::multimap,std::allocator>>::emplace': no matching 
overloaded function found
C:\Program Files\Microsoft Visual 
Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\map(557): note: could 
be 'std::_Tree_iterator>>> 
std::multimap,std::allocator>>::emplace(_Valty &&...)'
`

The StringRef constructor here is intended to take a ConstString object, which 
I assume is implicitly converted to a std::string_view by compilers other than 
Visual Studio's. To fix the VS build I made the StringRef initialization more 
explicit, as you can see in the diff.

This is my first time contributing to LLVM, please let me know if I can add any 
details/clarifications :)

>From b4df918d0ba02f9092f42ca7668788977fbd7a3e Mon Sep 17 00:00:00 2001
From: Luke Weiler 
Date: Mon, 11 Mar 2024 19:32:30 -0700
Subject: [PATCH] fix build break on windows

---
 lldb/source/Symbol/Symtab.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index c63bbe94fece0e..5b5bf5c3f6f8c7 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -125,7 +125,7 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder 
sort_order,
 
   std::multimap name_map;
   for (const Symbol  : m_symbols)
-name_map.emplace(llvm::StringRef(symbol.GetName()), );
+name_map.emplace(symbol.GetName().GetStringRef(), );
 
   for (const auto _to_symbol : name_map) {
 const Symbol *symbol = name_to_symbol.second;

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