From f820625503744472be8312bb70ee0da197816067 Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Thu, 19 May 2022 09:31:03 +0000 Subject: [PATCH] [flang][driver] Make driver accept `-module-dir` `-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 ` is accepted. However, `-J` (and other options for specifying various paths) accepts `-J` as well as `-J `. This patch makes sure that `-module-dir` behaves consistently with other such flags. Differential Revision: https://reviews.llvm.org/D125957 --- clang/include/clang/Driver/Options.td | 2 +- flang/test/Driver/write-module.f90 | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index e18b71b..e100711 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4776,7 +4776,7 @@ def cpp : Flag<["-"], "cpp">, Group, HelpText<"Enable predefined and command line preprocessor macros">; def nocpp : Flag<["-"], "nocpp">, Group, HelpText<"Disable predefined and command line preprocessor macros">; -def module_dir : Separate<["-"], "module-dir">, MetaVarName<"">, +def module_dir : JoinedOrSeparate<["-"], "module-dir">, MetaVarName<"">, HelpText<"Put MODULE files in ">, 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 baa480e..0be5c58 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 !-------------------------- ! 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 +!-------------------------- +! 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 (i.e. with space) +! -J !--------------------------- ! 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 (i.e. without space) +! -J !------------------------------ ! RUN: rm -rf %t && mkdir -p %t/dir-flang ! RUN: cd %t && %flang -fsyntax-only -J%t/dir-flang %s -- 2.7.4