forked from OSchip/llvm-project
Fix r195149. Triple should correctly reflect that target. If it contains ios,
e.g. thumbv7m-apple-ios3.0.0-eabi, then it should mean it's an iOS target. For embedded targets, the OS should be unknown, e.g. thumbv7m-apple-unknown-macho. Since Tim has recently fixed the triple, r195149 is no longer needed. rdar://15911035 llvm-svn: 200164
This commit is contained in:
parent
f9352a3880
commit
31dd9a6cc1
|
@ -137,37 +137,31 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's an environment specified in the triple, that means we're dealing
|
// Set the appropriate OS version define.
|
||||||
// with an embedded variant of some sort and don't want the platform
|
if (Triple.isiOS()) {
|
||||||
// version-min defines, so only add them if there's not one.
|
assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
|
||||||
if (Triple.getEnvironmentName().empty()) {
|
char Str[6];
|
||||||
// Set the appropriate OS version define.
|
Str[0] = '0' + Maj;
|
||||||
if (Triple.isiOS()) {
|
Str[1] = '0' + (Min / 10);
|
||||||
assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
|
Str[2] = '0' + (Min % 10);
|
||||||
char Str[6];
|
Str[3] = '0' + (Rev / 10);
|
||||||
Str[0] = '0' + Maj;
|
Str[4] = '0' + (Rev % 10);
|
||||||
Str[1] = '0' + (Min / 10);
|
Str[5] = '\0';
|
||||||
Str[2] = '0' + (Min % 10);
|
Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__",
|
||||||
Str[3] = '0' + (Rev / 10);
|
Str);
|
||||||
Str[4] = '0' + (Rev % 10);
|
} else if (Triple.isMacOSX()) {
|
||||||
Str[5] = '\0';
|
// Note that the Driver allows versions which aren't representable in the
|
||||||
Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__",
|
// define (because we only get a single digit for the minor and micro
|
||||||
Str);
|
// revision numbers). So, we limit them to the maximum representable
|
||||||
} else if (Triple.isMacOSX()) {
|
// version.
|
||||||
// Note that the Driver allows versions which aren't representable in the
|
assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
|
||||||
// define (because we only get a single digit for the minor and micro
|
char Str[5];
|
||||||
// revision numbers). So, we limit them to the maximum representable
|
Str[0] = '0' + (Maj / 10);
|
||||||
// version.
|
Str[1] = '0' + (Maj % 10);
|
||||||
assert(Triple.getEnvironmentName().empty() && "Invalid environment!");
|
Str[2] = '0' + std::min(Min, 9U);
|
||||||
assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
|
Str[3] = '0' + std::min(Rev, 9U);
|
||||||
char Str[5];
|
Str[4] = '\0';
|
||||||
Str[0] = '0' + (Maj / 10);
|
Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str);
|
||||||
Str[1] = '0' + (Maj % 10);
|
|
||||||
Str[2] = '0' + std::min(Min, 9U);
|
|
||||||
Str[3] = '0' + std::min(Rev, 9U);
|
|
||||||
Str[4] = '\0';
|
|
||||||
Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell users about the kernel if there is one.
|
// Tell users about the kernel if there is one.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// RUN: %clang -arch armv6m -dM -E %s | FileCheck %s
|
// RUN: %clang -arch armv6m -dM -E %s | FileCheck %s
|
||||||
// RUN: %clang -arch armv7m -dM -E %s | FileCheck %s
|
// RUN: %clang -arch armv7m -dM -E %s | FileCheck %s
|
||||||
// RUN: %clang -arch armv7em -dM -E %s | FileCheck %s
|
// RUN: %clang -arch armv7em -dM -E %s | FileCheck %s
|
||||||
// RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -dM -E %s | FileCheck %s
|
// RUN: %clang_cc1 -triple thumbv7m-apple-unknown-macho -dM -E %s | FileCheck %s
|
||||||
|
|
||||||
// CHECK-NOT: __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
// CHECK-NOT: __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
||||||
// CHECK-NOT: __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
// CHECK-NOT: __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||||
|
|
Loading…
Reference in New Issue