From: Daniel Dunbar Date: Tue, 16 Jun 2009 23:25:22 +0000 (+0000) Subject: Fake support for -print-multi-* X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12cfe036d809173a25af0104844d4bb66a92252b;p=clang Fake support for -print-multi-* - I think we will eventually need to support this for realz, and some build processes seem to depend on these options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73581 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def index 7045f145ee..abd07a92b1 100644 --- a/include/clang/Driver/Options.def +++ b/include/clang/Driver/Options.def @@ -565,9 +565,9 @@ OPTION("-print-file-name=", print_file_name_EQ, Joined, INVALID, INVALID, "", 0, OPTION("-print-ivar-layout", print_ivar_layout, Flag, INVALID, INVALID, "", 0, 0, 0) OPTION("-print-libgcc-file-name", print_libgcc_file_name, Flag, INVALID, INVALID, "", 0, "Print the library path for \"libgcc.a\"", 0) -OPTION("-print-multi-directory", print_multi_directory, Flag, INVALID, INVALID, "u", 0, 0, 0) -OPTION("-print-multi-lib", print_multi_lib, Flag, INVALID, INVALID, "u", 0, 0, 0) -OPTION("-print-multi-os-directory", print_multi_os_directory, Flag, INVALID, INVALID, "u", 0, 0, 0) +OPTION("-print-multi-directory", print_multi_directory, Flag, INVALID, INVALID, "", 0, 0, 0) +OPTION("-print-multi-lib", print_multi_lib, Flag, INVALID, INVALID, "", 0, 0, 0) +OPTION("-print-multi-os-directory", print_multi_os_directory, Flag, INVALID, INVALID, "", 0, 0, 0) OPTION("-print-prog-name=", print_prog_name_EQ, Joined, INVALID, INVALID, "", 0, "Print the full program path of ", "") OPTION("-print-search-dirs", print_search_dirs, Flag, INVALID, INVALID, "", 0, diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index 6196c13026..c9d0ef197d 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -50,6 +50,8 @@ public: // Accessors const HostInfo &getHost() const { return Host; } + const llvm::Triple &getTriple() const { return Triple; } + std::string getArchName() const { return Triple.getArchName(); } std::string getPlatform() const { return Triple.getVendorName(); } std::string getOS() const { return Triple.getOSName(); } diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d9a2c2c393..54704d4827 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -429,6 +429,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; }