diff options
Diffstat (limited to 'lib/Driver')
-rw-r--r-- | lib/Driver/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/Driver/Driver.cpp | 48 | ||||
-rw-r--r-- | lib/Driver/HostInfo.cpp | 34 |
3 files changed, 75 insertions, 9 deletions
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt index 7147d8f..42cbff9 100644 --- a/lib/Driver/CMakeLists.txt +++ b/lib/Driver/CMakeLists.txt @@ -17,3 +17,5 @@ add_clang_library(clangDriver Tools.cpp Types.cpp ) + +add_dependencies(clangSema ClangDiagnosticDriver) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d8c6a0a..8c2676b8 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -356,10 +356,15 @@ void Driver::PrintVersion(const Compilation &C) const { // don't know what the client would like to do. llvm::errs() << "clang version " CLANG_VERSION_STRING " (" - << vers << " " << revision << ")" << "\n"; + << vers << " " << revision << ")" << '\n'; const ToolChain &TC = C.getDefaultToolChain(); llvm::errs() << "Target: " << TC.getTripleString() << '\n'; + + // Print the threading model. + // + // FIXME: Implement correctly. + llvm::errs() << "Thread model: " << "posix" << '\n'; } bool Driver::HandleImmediateArgs(const Compilation &C) { @@ -429,6 +434,47 @@ bool Driver::HandleImmediateArgs(const Compilation &C) { return false; } + if (C.getArgs().hasArg(options::OPT_print_multi_lib)) { + // FIXME: We need tool chain support for this. + llvm::outs() << ".;\n"; + + switch (C.getDefaultToolChain().getTriple().getArch()) { + default: + break; + + case llvm::Triple::x86_64: + llvm::outs() << "x86_64;@m64" << "\n"; + break; + + case llvm::Triple::ppc64: + llvm::outs() << "ppc64;@m64" << "\n"; + break; + } + return false; + } + + // FIXME: What is the difference between print-multi-directory and + // print-multi-os-directory? + if (C.getArgs().hasArg(options::OPT_print_multi_directory) || + C.getArgs().hasArg(options::OPT_print_multi_os_directory)) { + switch (C.getDefaultToolChain().getTriple().getArch()) { + default: + case llvm::Triple::x86: + case llvm::Triple::ppc: + llvm::outs() << "." << "\n"; + break; + + case llvm::Triple::x86_64: + llvm::outs() << "x86_64" << "\n"; + break; + + case llvm::Triple::ppc64: + llvm::outs() << "ppc64" << "\n"; + break; + } + return false; + } + return true; } diff --git a/lib/Driver/HostInfo.cpp b/lib/Driver/HostInfo.cpp index 2d577f8..831e11b 100644 --- a/lib/Driver/HostInfo.cpp +++ b/lib/Driver/HostInfo.cpp @@ -108,16 +108,34 @@ ToolChain *DarwinHostInfo::getToolChain(const ArgList &Args, const char *ArchName) const { std::string Arch; if (!ArchName) { - Arch = getArchName(); + // If we aren't looking for a specific arch, infer the default architecture + // based on -arch and -m32/-m64 command line options. + if (Arg *A = Args.getLastArg(options::OPT_arch)) { + // The gcc driver behavior with multiple -arch flags wasn't consistent for + // things which rely on a default architecture. We just use the last -arch + // to find the default tool chain. + Arch = A->getValue(Args); + + // Normalize arch name; we shouldn't be doing this here. + // + // FIXME: This should be unnecessary once everything moves over to using + // the ID based Triple interface. + if (Arch == "ppc") + Arch = "powerpc"; + else if (Arch == "ppc64") + Arch = "powerpc64"; + } else { + // Otherwise default to the arch of the host. + Arch = getArchName(); + } ArchName = Arch.c_str(); - - // If no arch name is specified, infer it from the host and - // -m32/-m64. + + // Honor -m32 and -m64 when finding the default tool chain. if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) { - if (getArchName() == "i386" || getArchName() == "x86_64") { - ArchName = - (A->getOption().getId() == options::OPT_m32) ? "i386" : "x86_64"; - } else if (getArchName() == "powerpc" || getArchName() == "powerpc64") { + if (Arch == "i386" || Arch == "x86_64") { + ArchName = (A->getOption().getId() == options::OPT_m32) ? "i386" : + "x86_64"; + } else if (Arch == "powerpc" || Arch == "powerpc64") { ArchName = (A->getOption().getId() == options::OPT_m32) ? "powerpc" : "powerpc64"; } |