diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-16 18:50:54 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-16 18:50:54 +0000 |
| commit | 5ceb74a7d00005127c1355d3b5be29086124d090 (patch) | |
| tree | 4a5cba82d26f363ae560d31a9d95d0e04cee16f4 | |
| parent | 396fa1e5058f24373ccb1ee41a5e4e92a6a40e64 (diff) | |
| download | bcm5719-llvm-5ceb74a7d00005127c1355d3b5be29086124d090.tar.gz bcm5719-llvm-5ceb74a7d00005127c1355d3b5be29086124d090.zip | |
Make the auto-detection hack for the iOS simulator set the target triple correctly. Getting the target triple wrong mostly appears to work, but messes up in subtle cases; for example, we incorrectly conclude that fwrite is actually named fwrite$UNIX2003. Also shuffles around the auto-detection code a bit to try and make it a bit more reliable. Fixes <rdar://problem/10664848>.
llvm-svn: 148249
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 47 | ||||
| -rw-r--r-- | clang/test/Driver/ios-simulator-arcruntime.c | 1 |
2 files changed, 26 insertions, 22 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 5a1cd16cf78..7b2b2d880d5 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -534,28 +534,6 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { Arg *iOSSimVersion = Args.getLastArg( options::OPT_mios_simulator_version_min_EQ); - // FIXME: HACK! When compiling for the simulator we don't get a - // '-miphoneos-version-min' to help us know whether there is an ARC runtime - // or not; try to parse a __IPHONE_OS_VERSION_MIN_REQUIRED - // define passed in command-line. - if (!iOSVersion && !iOSSimVersion) { - for (arg_iterator it = Args.filtered_begin(options::OPT_D), - ie = Args.filtered_end(); it != ie; ++it) { - StringRef define = (*it)->getValue(Args); - if (define.startswith(SimulatorVersionDefineName())) { - unsigned Major = 0, Minor = 0, Micro = 0; - if (GetVersionFromSimulatorDefine(define, Major, Minor, Micro) && - Major < 10 && Minor < 100 && Micro < 100) { - ARCRuntimeForSimulator = Major < 5 ? ARCSimulator_NoARCRuntime - : ARCSimulator_HasARCRuntime; - LibCXXForSimulator = Major < 5 ? LibCXXSimulator_NotAvailable - : LibCXXSimulator_Available; - } - break; - } - } - } - if (OSXVersion && (iOSVersion || iOSSimVersion)) { getDriver().Diag(diag::err_drv_argument_not_allowed_with) << OSXVersion->getAsString(Args) @@ -641,6 +619,31 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { } } + // FIXME: HACK! When compiling for the simulator we can't depend + // on getting '-mios-simulator-version-min'; try to parse a + // __IPHONE_OS_VERSION_MIN_REQUIRED define passed in command-line. + if (OSXVersion) { + for (arg_iterator it = Args.filtered_begin(options::OPT_D), + ie = Args.filtered_end(); it != ie; ++it) { + StringRef define = (*it)->getValue(Args); + if (define.startswith(SimulatorVersionDefineName())) { + unsigned Major = 0, Minor = 0, Micro = 0; + if (GetVersionFromSimulatorDefine(define, Major, Minor, Micro) && + Major < 10 && Minor < 100 && Micro < 100) { + std::string iOSSimTarget; + llvm::raw_string_ostream(iOSSimTarget) + << Major << '.' << Minor << '.' << Micro; + const Option *O = Opts.getOption( + options::OPT_mios_simulator_version_min_EQ); + iOSSimVersion = Args.MakeJoinedArg(0, O, iOSSimTarget); + Args.append(iOSSimVersion); + OSXVersion = 0; + } + break; + } + } + } + // Reject invalid architecture combinations. if (iOSSimVersion && (getTriple().getArch() != llvm::Triple::x86 && getTriple().getArch() != llvm::Triple::x86_64)) { diff --git a/clang/test/Driver/ios-simulator-arcruntime.c b/clang/test/Driver/ios-simulator-arcruntime.c index bec9f7b1fdc..00cc2b5ac78 100644 --- a/clang/test/Driver/ios-simulator-arcruntime.c +++ b/clang/test/Driver/ios-simulator-arcruntime.c @@ -3,4 +3,5 @@ // // CHECK-OPTIONS1-NOT: -fobjc-runtime-has-weak +// CHECK-OPTIONS2: "-triple" "i386-apple-ios5.0.0" // CHECK-OPTIONS2: -fobjc-runtime-has-weak |

