[clang] 66f55a7 - [Flang] Re-enable -print-resource-dir compiler option (#96799)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 07:22:06 PDT 2024


Author: Michael Klemm
Date: 2024-06-28T16:22:00+02:00
New Revision: 66f55a7f483deb05ce3067a2565c381daf1d0f52

URL: https://github.com/llvm/llvm-project/commit/66f55a7f483deb05ce3067a2565c381daf1d0f52
DIFF: https://github.com/llvm/llvm-project/commit/66f55a7f483deb05ce3067a2565c381daf1d0f52.diff

LOG: [Flang] Re-enable -print-resource-dir compiler option (#96799)

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.

Added: 
    flang/test/Driver/print-resource-dir.F90

Modified: 
    clang/include/clang/Driver/Options.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 724cf3351b88c..1c2b8cfeef6ce 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 0000000000000..8fd35f1800df2
--- /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]]


        


More information about the cfe-commits mailing list