Replace __ANDROID_NDK__ with __ANDROID__

Summary:
This replaces all the uses of the __ANDROID_NDK__ define with __ANDROID__. This
is a preparatory step to remove our custom android toolchain file and rely on
the standard android NDK one instead, which does not provide this define.
Instead I rely, on __ANDROID__, which is set by the compiler.

I haven't yet removed the cmake variable with the same name, as we will need to
do something completely different there -- NDK toolchain defines
CMAKE_SYSTEM_NAME to Android, while our current one pretends it's linux.

Reviewers: tberghammer, zturner

Subscribers: danalbert, srhines, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D27305

llvm-svn: 288494
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index e31930f..f0d7e2e 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -29,7 +29,7 @@
 
 #if defined(__linux__) || defined(__FreeBSD__) ||                              \
     defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__)
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(__ANDROID__)
 #include <spawn.h>
 #endif
 #include <sys/syscall.h>
@@ -320,7 +320,7 @@
   return thread_self;
 #elif defined(__FreeBSD__)
   return lldb::tid_t(pthread_getthreadid_np());
-#elif defined(__ANDROID_NDK__)
+#elif defined(__ANDROID__)
   return lldb::tid_t(gettid());
 #elif defined(__linux__)
   return lldb::tid_t(syscall(SYS_gettid));
@@ -454,7 +454,7 @@
 
 FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
   FileSpec module_filespec;
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(__ANDROID__)
   Dl_info info;
   if (::dladdr(host_addr, &info)) {
     if (info.dli_fname)
@@ -622,7 +622,7 @@
 
 #if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
     defined(__GLIBC__) || defined(__NetBSD__)
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(__ANDROID__)
 // this method needs to be visible to macosx/Host.cpp and
 // common/Host.cpp.
 
@@ -956,7 +956,7 @@
   }
   return error.Success();
 }
-#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#endif // !defined(__ANDROID__)
 #endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) ||
        // defined (__GLIBC__) || defined(__NetBSD__)
 
diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp
index cbdb077..3e94908 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -33,7 +33,7 @@
 #include "lldb/Host/linux/AbstractSocket.h"
 #endif
 
-#ifdef __ANDROID_NDK__
+#ifdef __ANDROID__
 #include <arpa/inet.h>
 #include <asm-generic/errno-base.h>
 #include <bits/error_constants.h>
@@ -44,7 +44,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 #endif // ANDROID_ARM_BUILD_STATIC || ANDROID_MIPS_BUILD_STATIC
-#endif // __ANDROID_NDK__
+#endif // __ANDROID__
 
 using namespace lldb;
 using namespace lldb_private;
diff --git a/lldb/source/Host/linux/ProcessLauncherLinux.cpp b/lldb/source/Host/linux/ProcessLauncherLinux.cpp
index 4a51f8f..27a6329 100644
--- a/lldb/source/Host/linux/ProcessLauncherLinux.cpp
+++ b/lldb/source/Host/linux/ProcessLauncherLinux.cpp
@@ -26,7 +26,7 @@
 using namespace lldb_private;
 
 static void FixupEnvironment(Args &env) {
-#ifdef __ANDROID_NDK__
+#ifdef __ANDROID__
   // If there is no PATH variable specified inside the environment then set the
   // path to /system/bin. It is required because the default path used by
   // execve() is wrong on android.
diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp
index 689928c..38aac59 100644
--- a/lldb/source/Host/posix/HostInfoPosix.cpp
+++ b/lldb/source/Host/posix/HostInfoPosix.cpp
@@ -48,7 +48,7 @@
   return false;
 }
 
-#ifdef __ANDROID_NDK__
+#ifdef __ANDROID__
 #include <android/api-level.h>
 #endif
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
index c25fc49..346ea0b 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -20,6 +20,7 @@
 #include "lldb/DataFormatters/StringPrinter.h"
 #include "lldb/DataFormatters/TypeSummary.h"
 #include "lldb/Host/Endian.h"
+#include "lldb/Host/Time.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
@@ -28,12 +29,6 @@
 
 #include <algorithm>
 
-#if __ANDROID_NDK__
-#include <sys/types.h>
-#endif
-
-#include "lldb/Host/Time.h"
-
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 21f3c8c..5bca1de 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -9,7 +9,7 @@
 
 #include "ObjectContainerBSDArchive.h"
 
-#if defined(_WIN32) || defined(__ANDROID_NDK__)
+#if defined(_WIN32) || defined(__ANDROID__)
 // Defines from ar, missing on Windows
 #define ARMAG "!<arch>\n"
 #define SARMAG 8
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
index 03f7a62..95b106d 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
@@ -120,7 +120,7 @@
 // the same bytes size as "double"
 #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) &&       \
     !defined(_MSC_VER) && !defined(__mips__) && !defined(__powerpc__) &&       \
-    !defined(__ANDROID_NDK__)
+    !defined(__ANDROID__)
     case sizeof(long double):
       if (sizeof(long double) == sizeof(uint32_t)) {
         value.SetUInt32(reg_value, RegisterValue::eTypeLongDouble);
diff --git a/lldb/source/Utility/PseudoTerminal.cpp b/lldb/source/Utility/PseudoTerminal.cpp
index 5c320c2..4d99a56 100644
--- a/lldb/source/Utility/PseudoTerminal.cpp
+++ b/lldb/source/Utility/PseudoTerminal.cpp
@@ -20,7 +20,7 @@
 
 #include "lldb/Host/PosixApi.h"
 
-#if defined(__ANDROID_NDK__)
+#if defined(__ANDROID__)
 int posix_openpt(int flags);
 #endif