[flang-commits] [clang] [flang] [Flang] Re-enable -print-resource-dir compiler option (PR #96799)

via flang-commits flang-commits at lists.llvm.org
Wed Jun 26 10:03:55 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Michael Klemm (mjklemm)

<details>
<summary>Changes</summary>

This PR re-enables the command line option `-print-resources-dir` after PR #<!-- -->96557 has reverted the changes made.

The way this works now, is that it simply prints the current resource dir, which points to clang/$version.

---
Full diff: https://github.com/llvm/llvm-project/pull/96799.diff


2 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+4-1) 
- (added) flang/test/Driver/print-resource-dir.F90 (+4) 


``````````diff
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index dd55838dcf384b..4c514197de3ac9 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5535,7 +5535,10 @@ def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   Visibility<[ClangOption, CLOption]>;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
   HelpText<"Print the resource directory pathname">,
-  Visibility<[ClangOption, CLOption]>;
+  HelpTextForVariants<[FlangOption],
+                      "Print the resource directory pathname that contains lib and "
+                      "include directories with the runtime libraries and MODULE files.">,
+  Visibility<[ClangOption, CLOption, FlangOption]>;
 def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
   HelpText<"Print the paths used for finding libraries and programs">,
   Visibility<[ClangOption, CLOption]>;
diff --git a/flang/test/Driver/print-resource-dir.F90 b/flang/test/Driver/print-resource-dir.F90
new file mode 100644
index 00000000000000..8fd35f1800df21
--- /dev/null
+++ b/flang/test/Driver/print-resource-dir.F90
@@ -0,0 +1,4 @@
+! DEFINE: %{resource_dir} = %S/Inputs/resource_dir
+! RUN: %flang -print-resource-dir -resource-dir=%{resource_dir}.. \
+! RUN:  | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%{resource_dir} %s
+! PRINT-RESOURCE-DIR: [[FILE]]

``````````

</details>


https://github.com/llvm/llvm-project/pull/96799


More information about the flang-commits mailing list