From ca3459e95f552cfae6c9c5fb4ed161e3a662c25e Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 20 Mar 2009 04:37:21 +0000 Subject: [PATCH] Driver: Implement -print-search-dirs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67362 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.def | 2 +- lib/Driver/Driver.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def index 0819200613..f043efb383 100644 --- a/include/clang/Driver/Options.def +++ b/include/clang/Driver/Options.def @@ -472,7 +472,7 @@ OPTION("-print-multi-directory", print_multi_directory, Flag, INVALID, INVALID, OPTION("-print-multi-lib", print_multi_lib, Flag, INVALID, INVALID, "u", 0) OPTION("-print-multi-os-directory", print_multi_os_directory, Flag, INVALID, INVALID, "u", 0) OPTION("-print-prog-name=", print_prog_name_EQ, Joined, INVALID, INVALID, "", 0) -OPTION("-print-search-dirs", print_search_dirs, Flag, INVALID, INVALID, "u", 0) +OPTION("-print-search-dirs", print_search_dirs, Flag, INVALID, INVALID, "", 0) OPTION("-private_bundle", private__bundle, Flag, INVALID, INVALID, "", 0) OPTION("-pthreads", pthreads, Flag, INVALID, INVALID, "", 0) OPTION("-pthread", pthread, Flag, INVALID, INVALID, "", 0) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 10b73d3a0e..2ae88267b0 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -247,6 +247,25 @@ bool Driver::HandleImmediateArgs(const Compilation &C) { } const ToolChain &TC = C.getDefaultToolChain(); + if (C.getArgs().hasArg(options::OPT_print_search_dirs)) { + llvm::outs() << "programs: ="; + for (ToolChain::path_list::const_iterator it = TC.getProgramPaths().begin(), + ie = TC.getProgramPaths().end(); it != ie; ++it) { + if (it != TC.getProgramPaths().begin()) + llvm::outs() << ':'; + llvm::outs() << *it; + } + llvm::outs() << "\n"; + llvm::outs() << "libraries: ="; + for (ToolChain::path_list::const_iterator it = TC.getFilePaths().begin(), + ie = TC.getFilePaths().end(); it != ie; ++it) { + if (it != TC.getFilePaths().begin()) + llvm::outs() << ':'; + llvm::outs() << *it; + } + llvm::outs() << "\n"; + } + // FIXME: The following handlers should use a callback mechanism, we // don't know what the client would like to do. if (Arg *A = C.getArgs().getLastArg(options::OPT_print_file_name_EQ)) { -- 2.40.0