Use the new Triple::getMacOSXVersion function in another place.

I removed support for "*-darwin*-iphoneos" triples, since we now have
iOS listed as a separate OS in the triples.

llvm-svn: 149455
This commit is contained in:
Bob Wilson 2012-01-31 23:52:58 +00:00
parent c333749312
commit 8e5acc5cc1
4 changed files with 8 additions and 29 deletions

View File

@ -119,33 +119,12 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
// Get the platform type and version number from the triple.
unsigned Maj, Min, Rev;
// If no version was given, default to to 10.4.0, for simplifying tests.
if (Triple.getOSName() == "darwin" || Triple.getOSName() == "osx") {
if (Triple.isMacOSX()) {
Triple.getMacOSXVersion(Maj, Min, Rev);
PlatformName = "macosx";
Min = Rev = 0;
Maj = 8;
} else {
// Otherwise, honor all three triple forms ("-darwinNNN[-iphoneos]",
// "-osxNNN", and "-iosNNN").
if (Triple.getOS() == llvm::Triple::Darwin) {
// For historical reasons that make little sense, the version passed here
// is the "darwin" version, which drops the 10 and offsets by 4.
Triple.getOSVersion(Maj, Min, Rev);
if (Triple.getEnvironmentName() == "iphoneos") {
PlatformName = "ios";
} else {
PlatformName = "macosx";
Rev = Min;
Min = Maj - 4;
Maj = 10;
}
} else {
Triple.getOSVersion(Maj, Min, Rev);
PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
}
Triple.getOSVersion(Maj, Min, Rev);
PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
}
// If -target arch-pc-win32-macho option specified, we're
@ -157,7 +136,7 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
}
// Set the appropriate OS version define.
if (PlatformName == "ios") {
if (Triple.getOS() == llvm::Triple::IOS) {
assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
char Str[6];
Str[0] = '0' + Maj;

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
// RUN: %clang_cc1 -triple thumbv6-apple-ios4.0 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
@interface MyClass {}
- (void *)voidPtrM;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -triple=thumbv7-apple-darwin3.0.0-iphoneos -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios3.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
// CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4
// CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 "-triple" "x86_64-apple-darwin3.0.0-iphoneos" -fsyntax-only -verify %s
// RUN: %clang_cc1 "-triple" "x86_64-apple-ios3.0" -fsyntax-only -verify %s
void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1)));
void f1(int) __attribute__((availability(ios,introduced=2.1)));