summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2015-10-30 16:30:30 +0000
committerTim Northover <tnorthover@apple.com>2015-10-30 16:30:30 +0000
commit67465f80eca80beb18f1602095fe03c76b74d52e (patch)
treef19db1a3dfaf8d2c006f145140a9de72a0aea9e0 /clang/lib/Basic/Targets.cpp
parent6f3ff22e739441cfdcd8ad1de92dba6f48fa3da7 (diff)
downloadbcm5719-llvm-67465f80eca80beb18f1602095fe03c76b74d52e.tar.gz
bcm5719-llvm-67465f80eca80beb18f1602095fe03c76b74d52e.zip
Preprocessor: define correct tvOS and watchOS version macros
llvm-svn: 251707
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index a0c379aeb7f..2a220360088 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -162,7 +162,22 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
Str[3] = '0' + (Rev / 10);
Str[4] = '0' + (Rev % 10);
Str[5] = '\0';
- Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Str);
+ if (Triple.isTvOS())
+ Builder.defineMacro("__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__", Str);
+ else
+ Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__",
+ Str);
+
+ } else if (Triple.isWatchOS()) {
+ assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
+ char Str[6];
+ Str[0] = '0' + Maj;
+ Str[1] = '0' + (Min / 10);
+ Str[2] = '0' + (Min % 10);
+ Str[3] = '0' + (Rev / 10);
+ Str[4] = '0' + (Rev % 10);
+ Str[5] = '\0';
+ Builder.defineMacro("__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__", Str);
} else if (Triple.isMacOSX()) {
// Note that the Driver allows versions which aren't representable in the
// define (because we only get a single digit for the minor and micro
OpenPOWER on IntegriCloud