Skip to content

Commit 859a871

Browse files
Teemperorvgvassilev
authored andcommitted
[cxxmodules] Always enable -Rmodule-build
This will be replaced with a proper error message in the future once we have a reliable way of implmenting such an error. For now it's already an improvement if we always print a warning when we build a module on demand.
1 parent e8f4530 commit 859a871

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

core/dictgen/src/rootcling_impl.cxx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,12 +4292,9 @@ int RootClingMain(int argc,
42924292
clingArgsInterpreter.push_back("-fmodules-cache-path=" +
42934293
llvm::sys::path::parent_path(sharedLibraryPathName).str());
42944294

4295-
// If the user has passed ROOT_MODULES with the value 'DEBUG', then we
4296-
// enable remarks in clang for building on-demand modules. This is useful
4297-
// to figure out when and why on-demand modules are built by clang.
4298-
if (llvm::StringRef(getenv("ROOT_MODULES")) == "DEBUG") {
4299-
clingArgsInterpreter.push_back("-Rmodule-build");
4300-
}
4295+
// We enable remarks in clang for building on-demand modules. This is
4296+
// useful to figure out when and why on-demand modules are built by clang.
4297+
clingArgsInterpreter.push_back("-Rmodule-build");
43014298
}
43024299

43034300
// Convert arguments to a C array and check if they are sane

core/metacling/src/TCling.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,10 @@ TCling::TCling(const char *name, const char *title)
12581258
if (useCxxModules && !fromRootCling) {
12591259
// We only set this flag, rest is done by the CIFactory.
12601260
interpArgs.push_back("-fmodules");
1261+
// We should never build modules during runtime, so let's enable the
1262+
// module build remarks from clang to make it easier to spot when we do
1263+
// this by accident.
1264+
interpArgs.push_back("-Rmodule-build");
12611265

12621266
TString vfsPath = TROOT::GetIncludeDir() + "/modulemap.overlay.yaml";
12631267
// On modules aware build systems (such as OSX) we do not need an overlay file and thus the build system does not

0 commit comments

Comments
 (0)