[Lldb-commits] [lldb] [llvm] [lldb][NFC] Fix various warnings showing up in Xcode 27 (PR #213438)
David Mentler via lldb-commits
lldb-commits at lists.llvm.org
Sat Aug 1 05:28:17 PDT 2026
https://github.com/mentlerd created https://github.com/llvm/llvm-project/pull/213438
This PR fixes warnings that occur out-of-the-box when building lldb with Xcode 27 in standalone mode.
The exact warning messages are in commit descriptions.
>From 568b4498c6625f375a54200e53c586f7d3e35e0c Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 1 Aug 2026 10:32:53 +0200
Subject: [PATCH 1/4] Use LD_EXPORT_SYMBOLS with Xcode
Fixes:
.../llvm-project/build/lldb-xcode/lldb.xcodeproj: warning: The OTHER_LDFLAGS build setting is not allowed to contain -no_exported_symbols, use the dedicated LD_EXPORT_SYMBOLS build setting instead. (in target '...' from project 'lldb')
---
llvm/cmake/modules/AddLLVM.cmake | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index a267166eb6c2d..370a2dcfa424f 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1232,8 +1232,14 @@ macro(add_llvm_executable name)
NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
NOT ARG_EXPORT_SYMBOLS)
if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
- set_property(TARGET ${name} APPEND_STRING PROPERTY
- LINK_FLAGS " -Wl,-no_exported_symbols")
+ if (XCODE)
+ # warning: The OTHER_LDFLAGS build setting is not allowed to contain -no_exported_symbols,
+ # use the dedicated LD_EXPORT_SYMBOLS build setting instead.
+ set_target_properties(${name} PROPERTIES LD_EXPORT_SYMBOLS NO)
+ else()
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-no_exported_symbols")
+ endif()
else()
message(FATAL_ERROR
"LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES cannot be disabled when linker does not support \"-no_exported_symbols\"")
>From faa4df18a6ddb16c0ce8985bba2c0e8b20a27d2d Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 1 Aug 2026 10:33:56 +0200
Subject: [PATCH 2/4] Fix missing endline
Fixes:
.../llvm-project/lldb/source/Host/posix/FilePosix.cpp:238:30: warning: no newline at end of file [-Wnewline-eof]
---
lldb/source/Host/posix/FilePosix.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Host/posix/FilePosix.cpp b/lldb/source/Host/posix/FilePosix.cpp
index 27ef905fb6eb8..a09f042d8a3d6 100644
--- a/lldb/source/Host/posix/FilePosix.cpp
+++ b/lldb/source/Host/posix/FilePosix.cpp
@@ -235,4 +235,4 @@ Status NativeFilePosix::Write(const void *buf, size_t &num_bytes,
return error;
}
-char NativeFilePosix::ID = 0;
\ No newline at end of file
+char NativeFilePosix::ID = 0;
>From a0ac689ff2aaa9060f4ac28c6d8df1c8f3303d5e Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 1 Aug 2026 10:41:49 +0200
Subject: [PATCH 3/4] Set PRODUCT_BUNDLE_IDENTIFIER
Fixes:
.../llvm-project/build/lldb-xcode/lldb.xcodeproj: User-supplied CFBundleIdentifier value 'com.apple.LLDB.framework' in the Info.plist must be the same as the PRODUCT_BUNDLE_IDENTIFIER build setting value ''.
---
lldb/cmake/modules/LLDBFramework.cmake | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lldb/cmake/modules/LLDBFramework.cmake b/lldb/cmake/modules/LLDBFramework.cmake
index 23d9d49d0cefc..88a1c2b968e40 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -19,6 +19,8 @@ if(NOT APPLE_EMBEDDED)
MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+
+ XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.apple.LLDB.framework
)
else()
set_target_properties(liblldb PROPERTIES
>From b76e6039eab14e3d71854c7f4582a44ebf457340 Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 1 Aug 2026 10:53:27 +0200
Subject: [PATCH 4/4] Explicitly combine enum values types
Fixes:
.../llvm-project/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp: Bitwise operation between different enumeration types ('CommunicationKDP::CommandType' and 'CommunicationKDP::PacketType')
---
.../MacOSX-Kernel/CommunicationKDP.cpp | 73 ++++++++++---------
1 file changed, 39 insertions(+), 34 deletions(-)
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
index ce75ebfce7d8d..e89c79171f3a0 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
@@ -49,12 +49,17 @@ bool CommunicationKDP::SendRequestPacket(
return SendRequestPacketNoLock(request_packet);
}
+static constexpr uint8_t Combine(CommunicationKDP::PacketType packet_type,
+ CommunicationKDP::CommandType command_type) {
+ return uint8_t(command_type) | uint8_t(packet_type);
+}
+
void CommunicationKDP::MakeRequestPacketHeader(CommandType request_type,
PacketStreamType &request_packet,
uint16_t request_length) {
request_packet.Clear();
- request_packet.PutHex8(request_type |
- ePacketTypeRequest); // Set the request type
+ request_packet.PutHex8(
+ Combine(ePacketTypeRequest, request_type)); // Set the request type
request_packet.PutHex8(m_request_sequence_id++); // Sequence number
request_packet.PutHex16(
request_length); // Length of the packet including this header
@@ -252,8 +257,8 @@ bool CommunicationKDP::CheckForPacket(const uint8_t *src, size_t src_len,
lldb::offset_t offset = 0;
uint8_t reply_command = packet.GetU8(&offset);
switch (reply_command) {
- case ePacketTypeRequest | KDP_EXCEPTION:
- case ePacketTypeRequest | KDP_TERMINATION:
+ case Combine(ePacketTypeRequest, KDP_EXCEPTION):
+ case Combine(ePacketTypeRequest, KDP_TERMINATION):
// We got an exception request, so be sure to send an ACK
{
PacketStreamType request_ack_packet(Stream::eBinary, m_byte_order);
@@ -268,36 +273,36 @@ bool CommunicationKDP::CheckForPacket(const uint8_t *src, size_t src_len,
}
// Fall through to case below to get packet contents
[[fallthrough]];
- case ePacketTypeReply | KDP_CONNECT:
- case ePacketTypeReply | KDP_DISCONNECT:
- case ePacketTypeReply | KDP_HOSTINFO:
- case ePacketTypeReply | KDP_VERSION:
- case ePacketTypeReply | KDP_MAXBYTES:
- case ePacketTypeReply | KDP_READMEM:
- case ePacketTypeReply | KDP_WRITEMEM:
- case ePacketTypeReply | KDP_READREGS:
- case ePacketTypeReply | KDP_WRITEREGS:
- case ePacketTypeReply | KDP_LOAD:
- case ePacketTypeReply | KDP_IMAGEPATH:
- case ePacketTypeReply | KDP_SUSPEND:
- case ePacketTypeReply | KDP_RESUMECPUS:
- case ePacketTypeReply | KDP_BREAKPOINT_SET:
- case ePacketTypeReply | KDP_BREAKPOINT_REMOVE:
- case ePacketTypeReply | KDP_REGIONS:
- case ePacketTypeReply | KDP_REATTACH:
- case ePacketTypeReply | KDP_HOSTREBOOT:
- case ePacketTypeReply | KDP_READMEM64:
- case ePacketTypeReply | KDP_WRITEMEM64:
- case ePacketTypeReply | KDP_BREAKPOINT_SET64:
- case ePacketTypeReply | KDP_BREAKPOINT_REMOVE64:
- case ePacketTypeReply | KDP_KERNELVERSION:
- case ePacketTypeReply | KDP_READPHYSMEM64:
- case ePacketTypeReply | KDP_WRITEPHYSMEM64:
- case ePacketTypeReply | KDP_READIOPORT:
- case ePacketTypeReply | KDP_WRITEIOPORT:
- case ePacketTypeReply | KDP_READMSR64:
- case ePacketTypeReply | KDP_WRITEMSR64:
- case ePacketTypeReply | KDP_DUMPINFO: {
+ case Combine(ePacketTypeReply, KDP_CONNECT):
+ case Combine(ePacketTypeReply, KDP_DISCONNECT):
+ case Combine(ePacketTypeReply, KDP_HOSTINFO):
+ case Combine(ePacketTypeReply, KDP_VERSION):
+ case Combine(ePacketTypeReply, KDP_MAXBYTES):
+ case Combine(ePacketTypeReply, KDP_READMEM):
+ case Combine(ePacketTypeReply, KDP_WRITEMEM):
+ case Combine(ePacketTypeReply, KDP_READREGS):
+ case Combine(ePacketTypeReply, KDP_WRITEREGS):
+ case Combine(ePacketTypeReply, KDP_LOAD):
+ case Combine(ePacketTypeReply, KDP_IMAGEPATH):
+ case Combine(ePacketTypeReply, KDP_SUSPEND):
+ case Combine(ePacketTypeReply, KDP_RESUMECPUS):
+ case Combine(ePacketTypeReply, KDP_BREAKPOINT_SET):
+ case Combine(ePacketTypeReply, KDP_BREAKPOINT_REMOVE):
+ case Combine(ePacketTypeReply, KDP_REGIONS):
+ case Combine(ePacketTypeReply, KDP_REATTACH):
+ case Combine(ePacketTypeReply, KDP_HOSTREBOOT):
+ case Combine(ePacketTypeReply, KDP_READMEM64):
+ case Combine(ePacketTypeReply, KDP_WRITEMEM64):
+ case Combine(ePacketTypeReply, KDP_BREAKPOINT_SET64):
+ case Combine(ePacketTypeReply, KDP_BREAKPOINT_REMOVE64):
+ case Combine(ePacketTypeReply, KDP_KERNELVERSION):
+ case Combine(ePacketTypeReply, KDP_READPHYSMEM64):
+ case Combine(ePacketTypeReply, KDP_WRITEPHYSMEM64):
+ case Combine(ePacketTypeReply, KDP_READIOPORT):
+ case Combine(ePacketTypeReply, KDP_WRITEIOPORT):
+ case Combine(ePacketTypeReply, KDP_READMSR64):
+ case Combine(ePacketTypeReply, KDP_WRITEMSR64):
+ case Combine(ePacketTypeReply, KDP_DUMPINFO): {
offset = 2;
const uint16_t length = packet.GetU16(&offset);
if (length <= bytes_available) {
More information about the lldb-commits
mailing list