[Lldb-commits] [PATCH] D73938: [Host.mm] Check for the right macro instead of inlining it

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 10 14:43:43 PST 2020


vsk updated this revision to Diff 243679.
vsk added a reviewer: jasonmolenda.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73938/new/

https://reviews.llvm.org/D73938

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


Index: lldb/source/Host/macosx/objcxx/Host.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/Host.mm
+++ lldb/source/Host/macosx/objcxx/Host.mm
@@ -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 @@
   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 @@
   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 @@
   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 @@
   }
 
   return true;
-#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
+#endif // TARGET_OS_OSX
 }
 
 Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); }
@@ -689,7 +685,7 @@
   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 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;
@@ -1231,7 +1227,7 @@
 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;
 
@@ -1263,7 +1259,7 @@
   }
 
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73938.243679.patch
Type: text/x-patch
Size: 3044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200210/36376b3f/attachment.bin>


More information about the lldb-commits mailing list