[PATCH] D137058: [Driver] [Modules] Support -fsave-std-c++-module-file (1/2)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 19:52:31 PDT 2022


ChuanqiXu added a comment.

> so I can appreciate the -fsave-std-c++-module-file name here, but it does sound a bit verbose?

My thought is the option is mainly used by build systems so that the users wouldn't type it frequently. In this case, I feel it might not be bad to make it a little bit redundant. Someone's redundancy is another's readability : )

> Hmm, I don't mind that too much (& as you say, '-fobject-only' - though that flag is maybe too vague?) - but it does mean we'd need a separate flag to name the .pcm output file, because that flag ('-fmodule-only') wouldn't be present in all cases where the pcm is generated, only when it's pcm-but-no-object. Maybe less "exclusionary" flag names and more explicit (like '-fbuild-the-binary-module' and '-fbuild-the-object'). I guess most C++ GCC options ( https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html ) don't include "C++" in them, but the modules ones mostly include "module".

If this paragraph only talks about the GCC?

> We could get out in front, planning for the world in which BMIs are really only the interface (& whatever else we want to carry for optimizing /use/ of that interface, but not complete enough to be usable for generating the modules object) and use -fmodule-interface[=] (skipping the 'binary' part) and -fmodule-implementation or -fmodule-object (which could go either way - default on or off, but provide -fno-module-object to do the "generate PCM only")?

For clang, I would like to add `c++` in the option name since users are really easy to  get confused with the existing clang modules. I've met many such cases. And for the proposal it self, I feel it is complex and hard to understand.

>> GCC has "-fmodule-only" for which I have a patch (also unpublished) that aliases that to --precompile in the driver.

This idea sounds good to me. But I would like to suggest to change the name to `-fc++-module-interface-only`. Due to the same reason above. The name `-fmodule-only` is not clear especially in the context of clang now.

> Only other minor thing might be singular V plural - some of Clang's flags are -fmodules and others are -fmodule - any sense of what's likely to work better? (be nice to unify/standardize on one or the other, I can see having variation there might make for frustrating usability trying to remember which is which)

Yeah, sometimes it is frustrating. But I think we can't unify the existing options. It'd cause many breaking changes. And for `module` and `modules`, I prefer `module` a little more in practice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137058



More information about the cfe-commits mailing list