forked from OSchip/llvm-project
Reapply: [Host.mm] Check for the right macro instead of inlining it
Previously, this was reverted in bf65f19b
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.
This commit is contained in:
parent
7c771631c6
commit
f203100ebe
|
@ -9,13 +9,9 @@
|
|||
#include "lldb/Host/Host.h"
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
// On device doesn't have supporty for XPC.
|
||||
#if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__))
|
||||
#define NO_XPC_SERVICES 1
|
||||
#endif
|
||||
|
||||
#if !defined(NO_XPC_SERVICES)
|
||||
#if TARGET_OS_OSX
|
||||
#define __XPC_PRIVATE_H__
|
||||
#include <xpc/xpc.h>
|
||||
|
||||
|
@ -135,6 +131,8 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
|
||||
static void *AcceptPIDFromInferior(void *arg) {
|
||||
const char *connect_url = (const char *)arg;
|
||||
ConnectionFileDescriptor file_conn;
|
||||
|
@ -153,8 +151,6 @@ static void *AcceptPIDFromInferior(void *arg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
|
||||
|
||||
const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
|
||||
" activate\n"
|
||||
" do script \"/bin/bash -c '%s';exit\"\n"
|
||||
|
@ -307,13 +303,13 @@ LaunchInNewTerminalWithAppleScript(const char *exe_path,
|
|||
return error;
|
||||
}
|
||||
|
||||
#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
|
||||
#endif // TARGET_OS_OSX
|
||||
|
||||
bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
||||
uint32_t line_no) {
|
||||
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
|
||||
#if !TARGET_OS_OSX
|
||||
return false;
|
||||
#else
|
||||
#else // !TARGET_OS_OSX
|
||||
// We attach this to an 'odoc' event to specify a particular selection
|
||||
typedef struct {
|
||||
int16_t reserved0; // must be zero
|
||||
|
@ -404,7 +400,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
}
|
||||
|
||||
return true;
|
||||
#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
|
||||
#endif // TARGET_OS_OSX
|
||||
}
|
||||
|
||||
Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); }
|
||||
|
@ -689,7 +685,7 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if !NO_XPC_SERVICES
|
||||
#if TARGET_OS_OSX
|
||||
static void PackageXPCArguments(xpc_object_t message, const char *prefix,
|
||||
const Args &args) {
|
||||
size_t count = args.GetArgumentCount();
|
||||
|
@ -841,7 +837,7 @@ static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info) {
|
|||
static Status LaunchProcessXPC(const char *exe_path,
|
||||
ProcessLaunchInfo &launch_info,
|
||||
lldb::pid_t &pid) {
|
||||
#if !NO_XPC_SERVICES
|
||||
#if TARGET_OS_OSX
|
||||
Status error = getXPCAuthorization(launch_info);
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
@ -1194,7 +1190,7 @@ static Status LaunchProcessPosixSpawn(const char *exe_path,
|
|||
static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
|
||||
bool result = false;
|
||||
|
||||
#if !NO_XPC_SERVICES
|
||||
#if TARGET_OS_OSX
|
||||
bool launchingAsRoot = launch_info.GetUserID() == 0;
|
||||
bool currentUserIsRoot = HostInfo::GetEffectiveUserID() == 0;
|
||||
|
||||
|
@ -1226,7 +1222,7 @@ Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) {
|
|||
}
|
||||
|
||||
if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) {
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
|
||||
#if TARGET_OS_OSX
|
||||
return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(),
|
||||
launch_info);
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue