[Bug 46716] New: Fix ODR violations in LLDB

Bug ID 46716
Summary Fix ODR violations in LLDB
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter teemperor@gmail.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

LLDB fails to compile with latest GCC:

llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:124: warning: type
‘struct DataDescriptor_32’ violates the C++ One Definition Rule [-Wodr]
  124 |   struct DataDescriptor_32 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:281: note: a
different type is defined in another translation unit
  281 |   struct DataDescriptor_32 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:125: note: the first
difference of corresponding definitions is field ‘_used’
  125 |     uint32_t _used;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:282: note: a
field of same name but different type is defined in another translation unit
  282 |     uint32_t _used : 26;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:131: warning: type
‘struct DataDescriptor_64’ violates the C++ One Definition Rule [-Wodr]
  131 |   struct DataDescriptor_64 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:289: note: a
different type is defined in another translation unit
  289 |   struct DataDescriptor_64 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:132: note: the first
difference of corresponding definitions is field ‘_used’
  132 |     uint64_t _used;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:290: note: a
field of same name but different type is defined in another translation unit
  290 |     uint64_t _used : 58;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:314: warning:
type ‘struct DataDescriptor_32’ violates the C++ One Definition Rule [-Wodr]
  314 |   struct DataDescriptor_32 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:183: note: a different
type is defined in another translation unit
  183 |   struct DataDescriptor_32 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:315: note: the
first difference of corresponding definitions is field ‘_buffer’
  315 |     uint32_t _buffer;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:184: note: a field
with different name is defined in another translation unit
  184 |     uint32_t _cow;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:327: warning:
type ‘struct DataDescriptor_64’ violates the C++ One Definition Rule [-Wodr]
  327 |   struct DataDescriptor_64 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:192: note: a different
type is defined in another translation unit
  192 |   struct DataDescriptor_64 {
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:328: note: the
first difference of corresponding definitions is field ‘_buffer’
  328 |     uint64_t _buffer;
      > 
llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:193: note: a field
with different name is defined in another translation unit
  193 |     uint64_t _cow;
      > 
llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:136:
warning: ‘LLDBSwigPython_GetIndexOfChildWithName’ violates the C++ One
Definition Rule [-Wodr]
  136 | extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void
*implementor,
      > 
tools/lldb/bindings/LLDBWrapPython.cpp:79668:1: note:
‘LLDBSwigPython_GetIndexOfChildWithName’ was previously declared here
79668 | LLDBSwigPython_GetIndexOfChildWithName
      > ^
llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:97:
warning: ‘LLDBSwigPythonCallTypeScript’ violates the C++ One Definition Rule
[-Wodr]
   97 | extern "C" bool LLDBSwigPythonCallTypeScript(
      > 
tools/lldb/bindings/LLDBWrapPython.cpp:79221:1: note:
‘LLDBSwigPythonCallTypeScript’ was previously declared here
79221 | LLDBSwigPythonCallTypeScript
      > ^
llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:160:
warning: ‘LLDBSwigPythonCallCommandObject’ violates the C++ One Definition Rule
[-Wodr]
  160 | LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP
&debugger,
      > 
tools/lldb/bindings/LLDBWrapPython.cpp:79823:1: note:
‘LLDBSwigPythonCallCommandObject’ was previously declared here
79823 | LLDBSwigPythonCallCommandObject
      > ^
llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:180:
warning: ‘LLDBSwigPython_GetRecognizedArguments’ violates the C++ One
Definition Rule [-Wodr]
  180 | LLDBSwigPython_GetRecognizedArguments(void *implementor,
      > 
tools/lldb/bindings/LLDBWrapPython.cpp:79916:1: note:
‘LLDBSwigPython_GetRecognizedArguments’ was previously declared here
79916 | LLDBSwigPython_GetRecognizedArguments