[PATCH] D95448: [flang][driver] Add support for `-J/-module-dir`

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 19 17:33:18 PDT 2021


MaskRay added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1006-1007
   MarshallingInfoString<DependencyOutputOpts<"ModuleDependencyOutputDir">>;
+def module_dir : Separate<["-"], "module-dir">,
+  Flags<[FlangOption,FC1Option]>, HelpText<"Add to the list of directories to be searched by an USE statement">;
 def dsym_dir : JoinedOrSeparate<["-"], "dsym-dir">,
----------------
awarzynski wrote:
> awarzynski wrote:
> > As we are trying to follow `gfortran`, I suggest that we copy the help message from there:
> > 
> > ```
> > $ gfortran --help=separate | grep '\-J'
> >   -J<directory>               Put MODULE files in 'directory'
> > ```
> > Also, we can add the long version (via `DocBrief` field) from here https://gcc.gnu.org/onlinedocs/gfortran/Directory-Options.html:
> > ```
> > This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to searched by an USE statement.
> > 
> > The default is the current directory.
> > ```
> > 
> > I appreciate that this patch only implements the 2nd part of what the option is intended to offer (i.e. updates the search patch for module files). But I think that it's worthwhile to make the intent behind this option clear from the very beginning. We can use the commit message to document the current limitations.
> > 
> > Also, please keep in mind that this help message is going to be re-used by `-J`, which belongs to `gfortran_Group`. So the description needs to be valid for both.
> No indentation in `DocBrief`, see this [[ https://github.com/llvm/llvm-project/blob/21bfd068b32ece1c6fbc912208e7cd1782a8c3fc/clang/include/clang/Driver/Options.td#L680-L688 | example ]]
> 
> Also, `Put MODULE files in 'directory'` -> `Put MODULE files in <dir>` (the option is displayed as `-module-dir <dir>`).
Is the clang file change needed?

`clang -help` now has `  -module-dir <dir>       Put MODULE files in <dir>` while I think the option only makes sense for flang.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95448/new/

https://reviews.llvm.org/D95448



More information about the cfe-commits mailing list