From e79917b4fdf5d1715e547536f884ce2fc536d024 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Sun, 30 Sep 2018 13:03:48 -0700 Subject: [PATCH] [cxxmodules] Fall back to Header parsing on demand if we have no module. We assumed that we will always have module file and unconditionally disable header parsing on demand. However, the major use-case is gradual migration to modules. In this scenario (tested by root-meta-fwdDecls-fwdDeclarations), we have a dictionary which has no module file and still relies on the old behavior. This can realistically happen when users gradually migrate to modules. For example, we have modules-aware ROOT and untouched third party code. This patch enables header parsing on demand when we have no module file available. --- core/metacling/src/TCling.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/metacling/src/TCling.cxx b/core/metacling/src/TCling.cxx index d6b35d42f0879..ad9262a6f6dc7 100644 --- a/core/metacling/src/TCling.cxx +++ b/core/metacling/src/TCling.cxx @@ -1176,8 +1176,6 @@ TCling::TCling(const char *name, const char *title, const char* const argv[]) #ifdef R__USE_CXXMODULES useCxxModules = true; #endif - if (useCxxModules) - fHeaderParsingOnDemand = false; llvm::install_fatal_error_handler(&exceptionErrorHandler); @@ -1755,6 +1753,10 @@ void TCling::RegisterModule(const char* modulename, // I/O; see rootcling.cxx after the call to TCling__GetInterpreter(). if (fromRootCling) return; + // When we cannot provide a module for the library we should enable header + // parsing. This 'mixed' mode ensures gradual migration to modules. + fHeaderParsingOnDemand = !hasCxxModule; + // Treat Aclic Libs in a special way. Do not delay the parsing. bool hasHeaderParsingOnDemand = fHeaderParsingOnDemand; bool isACLiC = strstr(modulename, "_ACLiC_dict") != nullptr;