diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-12 05:01:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-12 05:01:48 +0000 |
commit | 6590d21767ebc65e22f4dfcf291bf30ca214eb56 (patch) | |
tree | 3ecb2a91e660502aa1f058a9c352313b58fa7627 /Driver/clang.cpp | |
parent | aeae19c42722925307f57dbb3845ada9921e37ab (diff) |
Simplify some code, don't force the triple to a darwin triple if non-darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r-- | Driver/clang.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 46321fa6f0..b526bb157f 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -426,38 +426,27 @@ namespace { } static void CreateTargetTriples(std::vector<std::string>& triples) { - std::string base_triple; - // Initialize base triple. If a -triple option has been specified, use // that triple. Otherwise, default to the host triple. - if (TargetTriple.getValue().empty()) { - // HACK: For non-darwin systems, we don't have any real target support - // yet. For these systems, set the target to darwin. - if (!strstr(LLVM_HOSTTRIPLE,"darwin")) - base_triple = "i386-apple-darwin"; - else - base_triple = LLVM_HOSTTRIPLE; - } - else - base_triple = TargetTriple.getValue(); + std::string Triple = TargetTriple; + if (Triple.empty()) Triple = LLVM_HOSTTRIPLE; // Decompose the base triple into "arch" and suffix. - std::string::size_type firstDash = base_triple.find("-"); + std::string::size_type firstDash = Triple.find("-"); if (firstDash == std::string::npos) { fprintf(stderr, "Malformed target triple: \"%s\" ('-' could not be found).\n", - base_triple.c_str()); - exit (1); + Triple.c_str()); + exit(1); } - std::string suffix(base_triple,firstDash+1); + std::string suffix(Triple, firstDash+1); if (suffix.empty()) { - fprintf(stderr, - "Malformed target triple: \"%s\" (no vendor or OS).\n", - base_triple.c_str()); - exit (1); + fprintf(stderr, "Malformed target triple: \"%s\" (no vendor or OS).\n", + Triple.c_str()); + exit(1); } // Create triple cacher. @@ -466,7 +455,7 @@ static void CreateTargetTriples(std::vector<std::string>& triples) { // Add the primary triple to our set of triples if we are using the // host-triple with no archs or using a specified target triple. if (!TargetTriple.getValue().empty() || Archs.empty()) - tp.addTriple(base_triple); + tp.addTriple(Triple); for (unsigned i = 0, e = Archs.size(); i !=e; ++i) tp.addTriple(Archs[i] + "-" + suffix); |