From 8e5acc5cc16ebaf04c4ebbce28e5fa2104bac646 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Tue, 31 Jan 2012 23:52:58 +0000 Subject: [PATCH] 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 --- clang/lib/Basic/Targets.cpp | 31 +++---------------- ...ceiver-undefined-larger-than-voidptr-ret.m | 2 +- clang/test/CodeGenCXX/arm.cpp | 2 +- clang/test/Sema/attr-availability-ios.c | 2 +- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 066439cd7b2c..698d627a17d7 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -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; diff --git a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m index eb15435600b9..eba72bac9f71 100644 --- a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -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; diff --git a/clang/test/CodeGenCXX/arm.cpp b/clang/test/CodeGenCXX/arm.cpp index 0a4754b815a5..36c6c1c6f8c3 100644 --- a/clang/test/CodeGenCXX/arm.cpp +++ b/clang/test/CodeGenCXX/arm.cpp @@ -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 diff --git a/clang/test/Sema/attr-availability-ios.c b/clang/test/Sema/attr-availability-ios.c index 435e312481d6..ea05e17bad8e 100644 --- a/clang/test/Sema/attr-availability-ios.c +++ b/clang/test/Sema/attr-availability-ios.c @@ -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)));