From 6cdef0efb7bf62cc44e80cd0c8973eda26d09db4 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 7 Dec 2017 19:04:10 +0000 Subject: [driver] Set the 'simulator' environment for Darwin when compiling for iOS/tvOS/watchOS simulator rdar://35135215 Differential Revision: https://reviews.llvm.org/D40682 llvm-svn: 320073 --- clang/lib/Frontend/InitPreprocessor.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 617b6aabcc7..a7ce2868a63 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -998,6 +998,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__nullable", "_Nullable"); } + // Add a macro to differentiate between regular iOS/tvOS/watchOS targets and + // the corresponding simulator targets. + if (TI.getTriple().isOSDarwin() && TI.getTriple().isSimulatorEnvironment()) + Builder.defineMacro("__APPLE_EMBEDDED_SIMULATOR__", "1"); + // OpenMP definition // OpenMP 2.2: // In implementations that support a preprocessor, the _OPENMP -- cgit v1.2.3