[PATCH] D31447: [Driver] Add option to print the resource directory
Catherine Moore via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 4 13:52:57 PDT 2017
clm updated this revision to Diff 94110.
clm added a subscriber: meadori.
clm added a comment.
I've now updated the patch to include your suggested revision of the test case. I don't have commit access yet, but meadori said that he would commit it for me.
https://reviews.llvm.org/D31447
Files:
include/clang/Driver/Options.td
lib/Driver/Driver.cpp
test/Driver/immediate-options.c
Index: test/Driver/immediate-options.c
===================================================================
--- test/Driver/immediate-options.c
+++ test/Driver/immediate-options.c
@@ -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: {{.+}}
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1145,6 +1145,11 @@
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;
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1938,6 +1938,8 @@
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">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31447.94110.patch
Type: text/x-patch
Size: 1844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170404/f3402d87/attachment.bin>
More information about the cfe-commits
mailing list