From: Axel Naumann Date: Tue, 9 Sep 2014 11:51:29 +0000 (+0200) Subject: Do not expose umbrella to FileManager. Fixed fwd decl callback. X-Git-Tag: v6-02-00-rc1~172 X-Git-Url: https://root.cern.ch/gitweb?p=root.git;a=commitdiff_plain;h=5142f54b86ca33c87fe5eb4abf5a5a93568f26d4 Do not expose umbrella to FileManager. Fixed fwd decl callback. Instead of #including the ubmrella header we now declare its content. This hides the umbrella header in the include chain, allowing the forward declarator of cling to detect that the include for TObject is TObject.h and not the umbrella header. This fixes the "healing" for the forward declarations when seeing the defining header being included. --- diff --git a/core/utils/src/rootcling.cxx b/core/utils/src/rootcling.cxx index 5ea479b..0855031 100644 --- a/core/utils/src/rootcling.cxx +++ b/core/utils/src/rootcling.cxx @@ -2164,31 +2164,20 @@ static bool InjectModuleUtilHeader(const char *argv0, { // Write the extra header injected into the module: // umbrella header if (umbrella) else content header. - const std::string &hdrName - = umbrella ? modGen.GetUmbrellaName() : modGen.GetContentName(); - { - std::ofstream out(hdrName); - if (!out) { - ROOT::TMetaUtils::Error(0, "%s: failed to open header output %s\n", - argv0, hdrName.c_str()); - return false; - } - if (umbrella) { - // This will duplicate the -D,-U from clingArgs - but as they are surrounded - // by #ifndef there is no problem here. - modGen.WriteUmbrellaHeader(out); - } else { - modGen.WriteContentHeader(out); - } + std::ostringstream out; + if (umbrella) { + // This will duplicate the -D,-U from clingArgs - but as they are surrounded + // by #ifndef there is no problem here. + modGen.WriteUmbrellaHeader(out); + } else { + modGen.WriteContentHeader(out); } - { - std::string includeDirective("#include \""); - includeDirective += hdrName + "\""; - if (interp.declare(includeDirective) != cling::Interpreter::kSuccess) { - ROOT::TMetaUtils::Error(0, "%s: compilation failure (%s)\n", argv0, - hdrName.c_str()); - return false; - } + if (interp.declare(out.str()) != cling::Interpreter::kSuccess) { + const std::string &hdrName + = umbrella ? modGen.GetUmbrellaName() : modGen.GetContentName(); + ROOT::TMetaUtils::Error(0, "%s: compilation failure (%s)\n", argv0, + hdrName.c_str()); + return false; } return true; }