diff --git a/core/clingutils/res/TClingUtils.h b/core/clingutils/res/TClingUtils.h index 45382a9993d7ca14f852b14445ccefff7d121c09..593252673bf1dcac9d368ab9ed4591ef018f0732 100644 --- a/core/clingutils/res/TClingUtils.h +++ b/core/clingutils/res/TClingUtils.h @@ -855,7 +855,7 @@ namespace AST2SourceTools { //______________________________________________________________________________ const std::string Decls2FwdDecls(const std::vector<const clang::Decl*> &decls, bool (*ignoreFiles)(const clang::PresumedLoc&) , - const cling::Interpreter& interp); + const cling::Interpreter& interp, std::string *logs); //______________________________________________________________________________ int PrepareArgsForFwdDecl(std::string& templateArgs, diff --git a/core/clingutils/src/TClingUtils.cxx b/core/clingutils/src/TClingUtils.cxx index 1566114415e81d94345ba6fc022a239702949470..2065189647334d92ce42dc71dd3f8f1c0868d401 100644 --- a/core/clingutils/src/TClingUtils.cxx +++ b/core/clingutils/src/TClingUtils.cxx @@ -5105,7 +5105,10 @@ bool ROOT::TMetaUtils::IsHeaderName(const std::string &filename) //////////////////////////////////////////////////////////////////////////////// -const std::string ROOT::TMetaUtils::AST2SourceTools::Decls2FwdDecls(const std::vector<const clang::Decl *> &decls, cling::Interpreter::IgnoreFilesFunc_t ignoreFiles, const cling::Interpreter &interp) +const std::string ROOT::TMetaUtils::AST2SourceTools::Decls2FwdDecls(const std::vector<const clang::Decl *> &decls, + cling::Interpreter::IgnoreFilesFunc_t ignoreFiles, + const cling::Interpreter &interp, + std::string *logs) { clang::Sema &sema = interp.getSema(); cling::Transaction theTransaction(sema); @@ -5117,8 +5120,15 @@ const std::string ROOT::TMetaUtils::AST2SourceTools::Decls2FwdDecls(const std::v } std::string newFwdDecl; llvm::raw_string_ostream llvmOstr(newFwdDecl); - interp.forwardDeclare(theTransaction, sema.getPreprocessor(), sema.getASTContext(), llvmOstr, true, nullptr, ignoreFiles); + + std::string locallogs; + llvm::raw_string_ostream llvmLogStr(locallogs); + interp.forwardDeclare(theTransaction, sema.getPreprocessor(), sema.getASTContext(), llvmOstr, true, + logs ? &llvmLogStr : nullptr, ignoreFiles); llvmOstr.flush(); + llvmLogStr.flush(); + if (logs) + logs->swap(locallogs); return newFwdDecl; } diff --git a/core/dictgen/src/rootcling_impl.cxx b/core/dictgen/src/rootcling_impl.cxx index ea0b671e968c56e2bf858efd40a60eea6b734bb7..4dc107dad458140d3a565a57c2c0f442ff6897af 100644 --- a/core/dictgen/src/rootcling_impl.cxx +++ b/core/dictgen/src/rootcling_impl.cxx @@ -3308,10 +3308,16 @@ static std::string GenerateFwdDeclString(const RScanner &scan, // for (auto* VAR: scan.fSelectedVariables) // selectedDecls.push_back(VAR); + std::string fwdDeclLogs; + // The "R\"DICTFWDDCLS(\n" ")DICTFWDDCLS\"" pieces have been moved to // TModuleGenerator to be able to make the diagnostics more telling in presence // of an issue ROOT-6752. - fwdDeclString += Decls2FwdDecls(selectedDecls,IsLinkdefFile,interp); + fwdDeclString += Decls2FwdDecls(selectedDecls,IsLinkdefFile,interp, genreflex::verbose ? &fwdDeclLogs : nullptr); + + if (genreflex::verbose && !fwdDeclLogs.empty()) + std::cout << "Logs from forward decl printer: \n" + << fwdDeclLogs; // Functions // for (auto const& fcnDeclPtr : scan.fSelectedFunctions){