diff options
author | Peter Klausler <35819229+klausler@users.noreply.github.com> | 2024-07-11 14:02:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 14:02:44 -0700 |
commit | 65987954d9903e4fa3dfbf1ccac9d942d4af1fbb (patch) | |
tree | 88ef4bf668cd4edfb7d338ba3f8b502b600cae0b /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | c9a4a27b9e490aff8d6ec21e55b22af0c882adb6 (diff) | |
download | llvm-65987954d9903e4fa3dfbf1ccac9d942d4af1fbb.zip llvm-65987954d9903e4fa3dfbf1ccac9d942d4af1fbb.tar.gz llvm-65987954d9903e4fa3dfbf1ccac9d942d4af1fbb.tar.bz2 |
[flang] Add -fhermetic-module-files (#98083)
Module files emitted by this Fortran compiler are valid Fortran source
files. Symbols that are USE-associated into modules are represented in
their module files with USE statements and special comments with hash
codes in them to ensure that those USE statements resolve to the same
modules that were used to build the module when its module file was
generated.
This scheme prevents unchecked module file growth in large applications
by not emitting USE-associated symbols redundantly. This problem can be
especially bad when derived type definitions must be repeated in the
module files of their clients, and the clients of those modules, and so
on. However, this scheme has the disadvantage that clients of modules
must be compiled with dependent modules in the module search path.
This new -fhermetic-module-files option causes module file output to be
free of dependences on any non-intrinsic module files; dependent modules
are instead emitted as part of the module file, rather than being
USE-associated. It is intended for top level library module files that
are shipped with binary libraries when it is not convenient to collect
and ship their dependent module files as well.
Fixes https://github.com/llvm/llvm-project/issues/97398.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index e2d60ad..37b5070 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -833,6 +833,11 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.setDebugModuleDir(true); } + // -fhermetic-module-files option + if (args.hasArg(clang::driver::options::OPT_fhermetic_module_files)) { + res.setHermeticModuleFileOutput(true); + } + // -module-suffix if (const auto *moduleSuffix = args.getLastArg(clang::driver::options::OPT_module_suffix)) { |