diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4776,7 +4776,7 @@ 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 --- 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