Skip to content

Commit f203100

Browse files
committed
Reapply: [Host.mm] Check for the right macro instead of inlining it
Previously, this was reverted in bf65f19 becuase it checked whether TARGET_OS_EMBEDDED is defined, but that macro is always defined. Update the condition to check that TARGET_OS_OSX is true.
1 parent 7c77163 commit f203100

File tree

1 file changed

+12
-16
lines changed
  • lldb/source/Host/macosx/objcxx

1 file changed

+12
-16
lines changed

lldb/source/Host/macosx/objcxx/Host.mm

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99
#include "lldb/Host/Host.h"
1010

1111
#include <AvailabilityMacros.h>
12+
#include <TargetConditionals.h>
1213

13-
// On device doesn't have supporty for XPC.
14-
#if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__))
15-
#define NO_XPC_SERVICES 1
16-
#endif
17-
18-
#if !defined(NO_XPC_SERVICES)
14+
#if TARGET_OS_OSX
1915
#define __XPC_PRIVATE_H__
2016
#include <xpc/xpc.h>
2117

@@ -135,6 +131,8 @@
135131
return false;
136132
}
137133

134+
#if TARGET_OS_OSX
135+
138136
static void *AcceptPIDFromInferior(void *arg) {
139137
const char *connect_url = (const char *)arg;
140138
ConnectionFileDescriptor file_conn;
@@ -153,8 +151,6 @@
153151
return NULL;
154152
}
155153

156-
#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
157-
158154
const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
159155
" activate\n"
160156
" do script \"/bin/bash -c '%s';exit\"\n"
@@ -307,13 +303,13 @@ repeat with the_window in (get windows)\n\
307303
return error;
308304
}
309305

310-
#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
306+
#endif // TARGET_OS_OSX
311307

312308
bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
313309
uint32_t line_no) {
314-
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
310+
#if !TARGET_OS_OSX
315311
return false;
316-
#else
312+
#else // !TARGET_OS_OSX
317313
// We attach this to an 'odoc' event to specify a particular selection
318314
typedef struct {
319315
int16_t reserved0; // must be zero
@@ -404,7 +400,7 @@ repeat with the_window in (get windows)\n\
404400
}
405401

406402
return true;
407-
#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
403+
#endif // TARGET_OS_OSX
408404
}
409405

410406
Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); }
@@ -689,7 +685,7 @@ static bool GetMacOSXProcessUserAndGroup(ProcessInstanceInfo &process_info) {
689685
return false;
690686
}
691687

692-
#if !NO_XPC_SERVICES
688+
#if TARGET_OS_OSX
693689
static void PackageXPCArguments(xpc_object_t message, const char *prefix,
694690
const Args &args) {
695691
size_t count = args.GetArgumentCount();
@@ -841,7 +837,7 @@ static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info) {
841837
static Status LaunchProcessXPC(const char *exe_path,
842838
ProcessLaunchInfo &launch_info,
843839
lldb::pid_t &pid) {
844-
#if !NO_XPC_SERVICES
840+
#if TARGET_OS_OSX
845841
Status error = getXPCAuthorization(launch_info);
846842
if (error.Fail())
847843
return error;
@@ -1194,7 +1190,7 @@ static Status LaunchProcessPosixSpawn(const char *exe_path,
11941190
static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
11951191
bool result = false;
11961192

1197-
#if !NO_XPC_SERVICES
1193+
#if TARGET_OS_OSX
11981194
bool launchingAsRoot = launch_info.GetUserID() == 0;
11991195
bool currentUserIsRoot = HostInfo::GetEffectiveUserID() == 0;
12001196

@@ -1226,7 +1222,7 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
12261222
}
12271223

12281224
if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) {
1229-
#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
1225+
#if TARGET_OS_OSX
12301226
return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(),
12311227
launch_info);
12321228
#else

0 commit comments

Comments
 (0)