diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-02 01:21:33 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-02 01:21:33 +0000 |
commit | e553a726fa52ed2f9a6472ded5d9b602a7af5af1 (patch) | |
tree | b776c03dc02d485a3fa5d9f86ea9d1a59e663c3a | |
parent | 14bfdfec4e8b1dd27e8b86cfdc5c350fedc554a1 (diff) |
(llvm up) If the target triple is unspecified, automatically set the
OS version part to that of the host on darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56943 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/clang.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 3ca5493d2c..1e26eaeac1 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -45,6 +45,7 @@ #include "llvm/Config/config.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/System/Host.h" #include "llvm/System/Path.h" #include "llvm/System/Signals.h" using namespace clang; @@ -672,7 +673,18 @@ static std::string CreateTargetTriple() { // Initialize base triple. If a -triple option has been specified, use // that triple. Otherwise, default to the host triple. std::string Triple = TargetTriple; - if (Triple.empty()) Triple = LLVM_HOSTTRIPLE; + if (Triple.empty()) { + Triple = LLVM_HOSTTRIPLE; + + // On darwin, we want to update the version to match that of the + // host. + std::string::size_type DarwinDashIdx = Triple.find("-darwin"); + if (DarwinDashIdx != std::string::npos) { + Triple.resize(DarwinDashIdx + strlen("-darwin")); + + Triple += llvm::sys::osVersion(); + } + } // If -arch foo was specified, remove the architecture from the triple we have // so far and replace it with the specified one. |