[PATCH] D125957: [flang][driver] Make driver accept `-module-dir<value>`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 02:40:41 PDT 2022


awarzynski created this revision.
awarzynski added a reviewer: rovka.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
awarzynski requested review of this revision.
Herald added subscribers: cfe-commits, jdoerfert.
Herald added a project: clang.

`-module-dir` is Flang's equivalent for `-J` from GFortran (in fact,
`-J` is an alias for `-module-dir` in Flang). Currently, only
`-module-dir <value>` is accepted. However, `-J` (and other options for
specifying various paths) accepts `-J <value>` as well as `-J<value>`.
This patch makes sure that `-module-dir` behaves consistently with other
such flags.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125957

Files:
  clang/include/clang/Driver/Options.td
  flang/test/Driver/write-module.f90


Index: flang/test/Driver/write-module.f90
===================================================================
--- flang/test/Driver/write-module.f90
+++ flang/test/Driver/write-module.f90
@@ -4,21 +4,28 @@
 ! We use `-fsyntax-only` as it stops after the semantic checks (the module file is generated when sema checks are run)
 
 !--------------------------
-! -module-dir
+! -module-dir <value>
 !--------------------------
 ! RUN: rm -rf %t && mkdir -p %t/dir-flang
 ! RUN: cd %t && %flang -fsyntax-only -module-dir %t/dir-flang %s
 ! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
 
+!--------------------------
+! -module-dir<value>
+!--------------------------
+! RUN: rm -rf %t && mkdir -p %t/dir-flang
+! RUN: cd %t && %flang -fsyntax-only -module-dir%t/dir-flang %s
+! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
+
 !---------------------------
-! -J <dir> (i.e. with space)
+! -J <value>
 !---------------------------
 ! RUN: rm -rf %t && mkdir -p %t/dir-flang
 ! RUN: cd %t && %flang -fsyntax-only -J %t/dir-flang %s
 ! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
 
 !------------------------------
-! -J<dir> (i.e. without space)
+! -J<value>
 !------------------------------
 ! RUN: rm -rf %t && mkdir -p %t/dir-flang
 ! RUN: cd %t && %flang -fsyntax-only -J%t/dir-flang %s
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4776,7 +4776,7 @@
   HelpText<"Enable predefined and command line preprocessor macros">;
 def nocpp : Flag<["-"], "nocpp">, Group<f_Group>,
   HelpText<"Disable predefined and command line preprocessor macros">;
-def module_dir : Separate<["-"], "module-dir">, MetaVarName<"<dir>">,
+def module_dir : JoinedOrSeparate<["-"], "module-dir">, MetaVarName<"<dir>">,
   HelpText<"Put MODULE files in <dir>">,
   DocBrief<[{This option specifies where to put .mod files for compiled modules.
 It is also added to the list of directories to be searched by an USE statement.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125957.430616.patch
Type: text/x-patch
Size: 2110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220519/42bc098e/attachment.bin>


More information about the cfe-commits mailing list