[Lldb-commits] [lldb] 306fc2c - [lldb] Fix build with GCC 9 after "[ADT] Use Empty Base Optimization for Allocators"

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 13 02:57:47 PDT 2022


Author: Martin Storsjö
Date: 2022-07-13T12:57:04+03:00
New Revision: 306fc2cd87f2a52c21eb3606eff33d78e25d9368

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

LOG: [lldb] Fix build with GCC 9 after "[ADT] Use Empty Base Optimization for Allocators"

This fixes this compilation error, after
a565509308f9372c4de1c4c32afde461a42e81c8:

In file included from ../tools/lldb/include/lldb/Host/Host.h:14,
                 from ../tools/lldb/source/Host/common/File.cpp:28:
../tools/lldb/include/lldb/Utility/Environment.h: In copy constructor ‘lldb_private::Environment::Environment(const lldb_private::Environment&)’:
../tools/lldb/include/lldb/Utility/Environment.h:60:49: error: call of overloaded ‘StringMap(const lldb_private::Environment&)’ is ambiguous
   60 |   Environment(const Environment &RHS) : Base(RHS) {}
      |                                                 ^
In file included from ../include/llvm/Support/YAMLTraits.h:16,
                 from ../tools/lldb/include/lldb/Utility/ConstString.h:15,
                 from ../tools/lldb/include/lldb/Utility/FileSpec.h:15,
                 from ../tools/lldb/include/lldb/Host/FileSystem.h:14,
                 from ../tools/lldb/source/Host/common/File.cpp:27:
../include/llvm/ADT/StringMap.h:137:3: note: candidate: ‘llvm::StringMap<ValueTy, AllocatorTy>::StringMap(const llvm::StringMap<ValueTy, AllocatorTy>&) [with ValueTy = std::__cxx11::basic_string<char>; AllocatorTy = llvm::MallocAllocator]’
  137 |   StringMap(const StringMap &RHS)
      |   ^~~~~~~~~
../include/llvm/ADT/StringMap.h:122:12: note: candidate: ‘llvm::StringMap<ValueTy, AllocatorTy>::StringMap(AllocatorTy) [with ValueTy = std::__cxx11::basic_string<char>; AllocatorTy = llvm::MallocAllocator]’
  122 |   explicit StringMap(AllocatorTy A)
      |            ^~~~~~~~~

Added: 
    

Modified: 
    lldb/include/lldb/Utility/Environment.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/Environment.h b/lldb/include/lldb/Utility/Environment.h
index c1549a3d60a64..27d740402c30c 100644
--- a/lldb/include/lldb/Utility/Environment.h
+++ b/lldb/include/lldb/Utility/Environment.h
@@ -57,7 +57,7 @@ class Environment : private llvm::StringMap<std::string> {
   using Base::operator[];
 
   Environment() {}
-  Environment(const Environment &RHS) : Base(RHS) {}
+  Environment(const Environment &RHS) : Base(static_cast<const Base&>(RHS)) {}
   Environment(Environment &&RHS) : Base(std::move(RHS)) {}
   Environment(char *const *Env)
       : Environment(const_cast<const char *const *>(Env)) {}


        


More information about the lldb-commits mailing list