[cfe-commits] r85601 - in /cfe/trunk: test/Coverage/targets.c test/Frontend/darwin-version.c tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Fri Oct 30 11:12:31 PDT 2009
Author: ddunbar
Date: Fri Oct 30 13:12:31 2009
New Revision: 85601
URL: http://llvm.org/viewvc/llvm-project?rev=85601&view=rev
Log:
Remove clang-cc code for handling -mmacosx-version-min and
-miphoneos-version-min.
Modified:
cfe/trunk/test/Coverage/targets.c
cfe/trunk/test/Frontend/darwin-version.c
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/test/Coverage/targets.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/targets.c?rev=85601&r1=85600&r2=85601&view=diff
==============================================================================
--- cfe/trunk/test/Coverage/targets.c (original)
+++ cfe/trunk/test/Coverage/targets.c Fri Oct 30 13:12:31 2009
@@ -18,6 +18,6 @@
// RUN: clang-cc -g -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
// <rdar://problem/7181838> clang 1.0 fails to compile Python 2.6
-// RUN: clang-cc -g -triple x86_64-apple-darwin9 -emit-llvm -o %t %s -mmacosx-version-min=10.4 &&
+// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -mmacosx-version-min=10.4 &&
// RUN: true
Modified: cfe/trunk/test/Frontend/darwin-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/darwin-version.c?rev=85601&r1=85600&r2=85601&view=diff
==============================================================================
--- cfe/trunk/test/Frontend/darwin-version.c (original)
+++ cfe/trunk/test/Frontend/darwin-version.c Fri Oct 30 13:12:31 2009
@@ -1,23 +1,23 @@
-// RUN: clang-cc -triple armv6-apple-darwin9 -dM -E -o %t - < /dev/null &&
-// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '10000' | count 1 &&
+// RUN: clang -ccc-host-triple armv6-apple-darwin9 -dM -E -o %t %s &&
+// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '30000' | count 1 &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 &&
-// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20000' | count 1 &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 &&
-// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin8 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin8 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin9 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin9 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin10 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin10 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 &&
-// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t - < /dev/null &&
+// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 &&
// RUN: true
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=85601&r1=85600&r2=85601&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Fri Oct 30 13:12:31 2009
@@ -657,6 +657,10 @@
TargetABI("target-abi",
llvm::cl::desc("Target a particular ABI type"));
+static llvm::cl::opt<std::string>
+TargetTriple("triple",
+ llvm::cl::desc("Specify target triple (e.g. i686-apple-darwin9)"));
+
// It might be nice to add bounds to the CommandLine library directly.
struct OptLevelParser : public llvm::cl::parser<unsigned> {
@@ -876,123 +880,6 @@
}
//===----------------------------------------------------------------------===//
-// Target Triple Processing.
-//===----------------------------------------------------------------------===//
-
-static llvm::cl::opt<std::string>
-TargetTriple("triple",
- llvm::cl::desc("Specify target triple (e.g. i686-apple-darwin9)"));
-
-static llvm::cl::opt<std::string>
-MacOSVersionMin("mmacosx-version-min",
- llvm::cl::desc("Specify target Mac OS X version (e.g. 10.5)"));
-
-// If -mmacosx-version-min=10.3.9 is specified, change the triple from being
-// something like powerpc-apple-darwin9 to powerpc-apple-darwin7
-
-// FIXME: We should have the driver do this instead.
-static void HandleMacOSVersionMin(llvm::Triple &Triple) {
- if (Triple.getOS() != llvm::Triple::Darwin) {
- fprintf(stderr,
- "-mmacosx-version-min only valid for darwin (Mac OS X) targets\n");
- exit(1);
- }
-
- // Validate that MacOSVersionMin is a 'version number', starting with 10.[3-9]
- if (MacOSVersionMin.size() < 4 ||
- MacOSVersionMin.substr(0, 3) != "10." ||
- !isdigit(MacOSVersionMin[3])) {
- fprintf(stderr,
- "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n",
- MacOSVersionMin.c_str());
- exit(1);
- }
-
- unsigned VersionNum = MacOSVersionMin[3]-'0';
- llvm::SmallString<16> NewDarwinString;
- NewDarwinString += "darwin";
-
- // Turn MacOSVersionMin into a darwin number: e.g. 10.3.9 is 3 -> darwin7.
- VersionNum += 4;
- if (VersionNum > 9) {
- NewDarwinString += '1';
- VersionNum -= 10;
- }
- NewDarwinString += (VersionNum+'0');
-
- if (MacOSVersionMin.size() == 4) {
- // "10.4" is ok.
- } else if (MacOSVersionMin.size() == 6 &&
- MacOSVersionMin[4] == '.' &&
- isdigit(MacOSVersionMin[5])) { // 10.4.7 is ok.
- // Add the period piece (.7) to the end of the triple. This gives us
- // something like ...-darwin8.7
- NewDarwinString += '.';
- NewDarwinString += MacOSVersionMin[5];
- } else { // "10.4" is ok. 10.4x is not.
- fprintf(stderr,
- "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n",
- MacOSVersionMin.c_str());
- exit(1);
- }
-
- Triple.setOSName(NewDarwinString.str());
-}
-
-static llvm::cl::opt<std::string>
-IPhoneOSVersionMin("miphoneos-version-min",
- llvm::cl::desc("Specify target iPhone OS version (e.g. 2.0)"));
-
-// If -miphoneos-version-min=2.2 is specified, change the triple from being
-// something like armv6-apple-darwin10 to armv6-apple-darwin9.2.2. We use
-// 9 as the default major Darwin number, and encode the iPhone OS version
-// number in the minor version and revision.
-
-// FIXME: We should have the driver do this instead.
-static void HandleIPhoneOSVersionMin(llvm::Triple &Triple) {
- if (Triple.getOS() != llvm::Triple::Darwin) {
- fprintf(stderr,
- "-miphoneos-version-min only valid for darwin (Mac OS X) targets\n");
- exit(1);
- }
-
- // Validate that IPhoneOSVersionMin is a 'version number', starting with
- // [2-9].[0-9]
- if (IPhoneOSVersionMin.size() != 3 || !isdigit(IPhoneOSVersionMin[0]) ||
- IPhoneOSVersionMin[1] != '.' || !isdigit(IPhoneOSVersionMin[2])) {
- fprintf(stderr,
- "-miphoneos-version-min=%s is invalid, expected something like '2.0'.\n",
- IPhoneOSVersionMin.c_str());
- exit(1);
- }
-
- // Turn IPhoneOSVersionMin into a darwin number: e.g. 2.0 is 2 -> 9.2.0
- llvm::SmallString<16> NewDarwinString;
- NewDarwinString += "darwin9.";
- NewDarwinString += IPhoneOSVersionMin;
- Triple.setOSName(NewDarwinString.str());
-}
-
-/// CreateTargetTriple - Process the various options that affect the target
-/// triple and build a final aggregate triple that we are compiling for.
-static llvm::Triple CreateTargetTriple() {
- // Initialize base triple. If a -triple option has been specified, use
- // that triple. Otherwise, default to the host triple.
- llvm::Triple Triple(TargetTriple);
- if (Triple.getTriple().empty())
- Triple = llvm::Triple(llvm::sys::getHostTriple());
-
- // If -mmacosx-version-min=10.3.9 is specified, change the triple from being
- // something like powerpc-apple-darwin9 to powerpc-apple-darwin7
- if (!MacOSVersionMin.empty())
- HandleMacOSVersionMin(Triple);
- else if (!IPhoneOSVersionMin.empty())
- HandleIPhoneOSVersionMin(Triple);
-
- return Triple;
-}
-
-//===----------------------------------------------------------------------===//
// SourceManager initialization.
//===----------------------------------------------------------------------===//
@@ -2323,8 +2210,13 @@
llvm::llvm_install_error_handler(LLVMErrorHandler,
static_cast<void*>(&Diags));
+ // Initialize base triple. If a -triple option has been specified, use
+ // that triple. Otherwise, default to the host triple.
+ llvm::Triple Triple(TargetTriple);
+ if (Triple.getTriple().empty())
+ Triple = llvm::Triple(llvm::sys::getHostTriple());
+
// Get information about the target being compiled for.
- llvm::Triple Triple = CreateTargetTriple();
llvm::OwningPtr<TargetInfo>
Target(TargetInfo::CreateTargetInfo(Triple.getTriple()));
More information about the cfe-commits
mailing list