r299473 - [Driver] Add option to print the resource directory
Meador Inge via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 4 14:46:51 PDT 2017
Author: meadori
Date: Tue Apr 4 16:46:50 2017
New Revision: 299473
URL: http://llvm.org/viewvc/llvm-project?rev=299473&view=rev
Log:
[Driver] Add option to print the resource directory
This patch adds the option -print-resource-dir. It simply
prints the resource directory. This information will eventually
be used in compiler-rt to setup COMPILER_RT_LIBRARY_INSTALL_DIR.
Patch by Catherine Moore!
Differential Revision: https://reviews.llvm.org/D31447
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/immediate-options.c
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=299473&r1=299472&r2=299473&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Apr 4 16:46:50 2017
@@ -2091,6 +2091,8 @@ def print_multi_os_directory : Flag<["-"
Flags<[Unsupported]>;
def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
HelpText<"Print the full program path of <name>">, MetaVarName<"<name>">;
+def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
+ HelpText<"Print the resource directory pathname">;
def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
HelpText<"Print the paths used for finding libraries and programs">;
def private__bundle : Flag<["-"], "private_bundle">;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=299473&r1=299472&r2=299473&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Apr 4 16:46:50 2017
@@ -1169,6 +1169,11 @@ bool Driver::HandleImmediateArgs(const C
if (C.getArgs().hasArg(options::OPT_v))
TC.printVerboseInfo(llvm::errs());
+ if (C.getArgs().hasArg(options::OPT_print_resource_dir)) {
+ llvm::outs() << ResourceDir;
+ return false;
+ }
+
if (C.getArgs().hasArg(options::OPT_print_search_dirs)) {
llvm::outs() << "programs: =";
bool separator = false;
Modified: cfe/trunk/test/Driver/immediate-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/immediate-options.c?rev=299473&r1=299472&r2=299473&view=diff
==============================================================================
--- cfe/trunk/test/Driver/immediate-options.c (original)
+++ cfe/trunk/test/Driver/immediate-options.c Tue Apr 4 16:46:50 2017
@@ -12,3 +12,8 @@
// RUN: %clang -print-search-dirs | FileCheck %s -check-prefix=PRINT-SEARCH-DIRS
// PRINT-SEARCH-DIRS: programs: ={{.*}}
// PRINT-SEARCH-DIRS: libraries: ={{.*}}
+
+// Test if the -print-resource-dir option is accepted without error.
+// Allow unspecified output because the value of CLANG_RESOURCE_DIR is unknown.
+// RUN: %clang -print-resource-dir | FileCheck %s -check-prefix=PRINT-RESOURCE-DIR
+// PRINT-RESOURCE-DIR: {{.+}}
More information about the cfe-commits
mailing list