[flang-commits] [flang] f820625 - [flang][driver] Make driver accept `-module-dir<value>`

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Thu May 19 04:14:22 PDT 2022


Author: Andrzej Warzynski
Date: 2022-05-19T11:13:35Z
New Revision: f820625503744472be8312bb70ee0da197816067

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

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

`-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.

Differential Revision: https://reviews.llvm.org/D125957

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index e18b71ba064df..e100711516089 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4776,7 +4776,7 @@ def cpp : Flag<["-"], "cpp">, Group<f_Group>,
   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.

diff  --git a/flang/test/Driver/write-module.f90 b/flang/test/Driver/write-module.f90
index baa480e055b98..0be5c5817ba90 100644
--- a/flang/test/Driver/write-module.f90
+++ b/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


        


More information about the flang-commits mailing list