Logo ROOT   6.18/05
Reference Guide
Namespaces | Macros | Typedefs | Functions | Variables
rootcling_impl.cxx File Reference
#include "rootcling_impl.h"
#include "rootclingCommandLineOptionsHelp.h"
#include "RConfigure.h"
#include <ROOT/RConfig.hxx>
#include <iostream>
#include <iomanip>
#include <memory>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <errno.h>
#include <string>
#include <list>
#include <sstream>
#include <map>
#include <fstream>
#include <sys/stat.h>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <limits.h>
#include <unistd.h>
#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InterpreterCallbacks.h"
#include "cling/Interpreter/LookupHelper.h"
#include "cling/Interpreter/Value.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Mangle.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/MemoryBufferCache.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/ModuleMap.h"
#include "clang/Lex/Pragma.h"
#include "clang/Sema/Sema.h"
#include "clang/Serialization/ASTWriter.h"
#include "cling/Utils/AST.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "RtypesCore.h"
#include "TModuleGenerator.h"
#include "TClassEdit.h"
#include "TClingUtils.h"
#include "RStl.h"
#include "XMLReader.h"
#include "LinkdefReader.h"
#include "DictSelectionReader.h"
#include "SelectionRules.h"
#include "Scanner.h"
#include "strlcpy.h"
#include "OptionParser.h"
#include "clang/Basic/LangOptions.def"
Include dependency graph for rootcling_impl.cxx:

Namespaces

namespace  genreflex
 

Macros

#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
 
#define LANGOPT(Name, Bits, Default, Description)    ROOT::TMetaUtils::Info(0, "%s = %d // %s\n", #Name, (int)LangOpts.Name, Description);
 

Typedefs

using HeadersDeclsMap_t = std::map< std::string, std::list< std::string > >
 

Functions

void AddPlatformDefines (std::vector< std::string > &clingArgs)
 
void genreflex::AddToArgVector (std::vector< char * > &argvVector, const std::vector< std::string > &argsToBeAdded, const std::string &optName="")
 
void genreflex::AddToArgVectorSplit (std::vector< char * > &argvVector, const std::vector< std::string > &argsToBeAdded, const std::string &optName="")
 
void AdjustRootMapNames (std::string &rootmapFileName, std::string &rootmapLibName)
 
void AnnotateAllDeclsForPCH (cling::Interpreter &interp, RScanner &scan)
 We need annotations even in the PCH: // !, // || etc. More...
 
void AnnotateDecl (clang::CXXRecordDecl &CXXRD, const RScanner::DeclsSelRulesMap_t &declSelRulesMap, cling::Interpreter &interpreter, bool isGenreflex)
 
void AnnotateFieldDecl (clang::FieldDecl &decl, const std::list< VariableSelectionRule > &fieldSelRules, bool isGenreflex)
 
void CallWriteStreamer (const ROOT::TMetaUtils::AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, std::ostream &dictStream, bool isAutoStreamer)
 
void genreflex::changeExtension (std::string &filename, const std::string &newExtension)
 
bool CheckClassDef (const clang::RecordDecl &cl, const cling::Interpreter &interp)
 Return false if the class does not have ClassDef even-though it should. More...
 
int CheckClassesForInterpreterOnlyDicts (cling::Interpreter &interp, RScanner &scan)
 
void CheckClassNameForRootMap (const std::string &classname, map< string, string > &autoloads)
 
void CheckForMinusW (const char *arg, std::list< std::string > &diagnosticPragmas)
 Transform -W statements in diagnostic pragmas for cling reacting on "-Wno-" For example -Wno-deprecated-declarations --> #pragma clang diagnostic ignored "-Wdeprecated-declarations". More...
 
int CheckForUnsupportedClasses (const RScanner::ClassColl_t &annotatedRcds)
 Check if the list of selected classes contains any class which is not supported. More...
 
unsigned int genreflex::checkHeadersNames (std::vector< std::string > &headersNames)
 Loop on arguments: stop at the first which starts with -. More...
 
bool CheckInputOperator (const char *what, const char *proto, const string &fullname, const clang::RecordDecl *cl, cling::Interpreter &interp)
 Check if the specified operator (what) has been properly declared if the user has requested a custom version. More...
 
bool CheckInputOperator (const clang::RecordDecl *cl, cling::Interpreter &interp)
 Check if the operator>> has been properly declared if the user has requested a custom version. More...
 
static bool CheckModuleValid (TModuleGenerator &modGen, const std::string &resourceDir, cling::Interpreter &interpreter, StringRef LinkdefPath, const std::string &moduleName)
 Check moduleName validity from modulemap. Check if this module is defined or not. More...
 
std::list< std::string > CollapseIdenticalNamespaces (const std::list< std::string > &fwdDeclarationsList)
 If two identical namespaces are there, just declare one only Example: namespace A { namespace B { fwd1; }} namespace A { namespace B { fwd2; }} get a namespace A { namespace B { fwd1; fwd2; }} line. More...
 
const char * CopyArg (const char *original)
 If the argument starts with MODULE/inc, strip it to make it the name we can use in #includes. More...
 
void CreateDictHeader (std::ostream &dictStream, const std::string &main_dictname)
 
int CreateNewRootMapFile (const std::string &rootmapFileName, const std::string &rootmapLibName, const std::list< std::string > &classesDefsList, const std::list< std::string > &classesNames, const std::list< std::string > &nsNames, const std::list< std::string > &tdNames, const std::list< std::string > &enNames, const std::list< std::string > &varNames, const HeadersDeclsMap_t &headersClassesMap, const std::unordered_set< std::string > headersToIgnore)
 Generate a rootmap file in the new format, like { decls } namespace A { namespace B { template <typename T> class myTemplate; } } [libGpad.so libGraf.so libHist.so libMathCore.so] class TAttCanvas class TButton (header1.h header2.h . More...
 
std::ostream * CreateStreamPtrForSplitDict (const std::string &dictpathname, tempFileNamesCatalog &tmpCatalog)
 Transform name of dictionary. More...
 
static void EmitEnums (const std::vector< const clang::EnumDecl * > &enumvec)
 
void EmitStreamerInfo (const char *normName)
 
static void EmitTypedefs (const std::vector< const clang::TypedefNameDecl * > &tdvec)
 
unsigned int genreflex::extractArgs (int argc, char **argv, std::vector< std::string > &args)
 Extract the arguments from the command line. More...
 
template<class COLL >
int ExtractAutoloadKeys (std::list< std::string > &names, const COLL &decls, const cling::Interpreter &interp)
 
int ExtractClassesListAndDeclLines (RScanner &scan, std::list< std::string > &classesList, std::list< std::string > &classesListForRootmap, std::list< std::string > &fwdDeclarationsList, const cling::Interpreter &interpreter)
 
std::string ExtractFileName (const std::string &path)
 Extract the filename from a fullpath. More...
 
void ExtractFilePath (const std::string &path, std::string &dirname)
 Extract the path from a fullpath finding the last \ or / according to the content in gPathSeparator. More...
 
void ExtractHeadersForDecls (const RScanner::ClassColl_t &annotatedRcds, const RScanner::TypedefColl_t tDefDecls, const RScanner::FunctionColl_t funcDecls, const RScanner::VariableColl_t varDecls, const RScanner::EnumColl_t enumDecls, HeadersDeclsMap_t &headersClassesMap, HeadersDeclsMap_t &headersDeclsMap, const cling::Interpreter &interp)
 
int extractMultipleOptions (std::vector< ROOT::option::Option > &options, int oIndex, std::vector< std::string > &values)
 Extract from options multiple values with the same option. More...
 
void ExtractSelectedNamespaces (RScanner &scan, std::list< std::string > &nsList)
 Loop on selected classes and put them in a list. More...
 
int FinalizeStreamerInfoWriting (cling::Interpreter &interp, bool writeEmptyRootPCM=false)
 Make up for skipping RegisterModule, now that dictionary parsing is done and these headers cannot be selected anymore. More...
 
static bool GenerateAllDict (TModuleGenerator &modGen, clang::CompilerInstance *compilerInstance, const std::string &currentDirectory)
 Generates a PCH from the given ModuleGenerator and CompilerInstance. More...
 
int GenerateFullDict (std::ostream &dictStream, cling::Interpreter &interp, RScanner &scan, const ROOT::TMetaUtils::RConstructorTypes &ctorTypes, bool isSplit, bool isGenreflex, bool writeEmptyRootPCM)
 
std::string GenerateFwdDeclString (const RScanner &scan, const cling::Interpreter &interp)
 Generate the fwd declarations of the selected entities. More...
 
void GenerateLinkdef (int *argc, char **argv, int firstInputFile, std::string &code_for_parser)
 
void GenerateNecessaryIncludes (std::ostream &dictStream, const std::string &includeForSource, const std::string &extraIncludes)
 
const std::string GenerateStringFromHeadersForClasses (const HeadersDeclsMap_t &headersClassesMap, const std::string &detectedUmbrella, bool payLoadOnly=false)
 Generate a string for the dictionary from the headers-classes map. More...
 
int GenReflexMain (int argc, char **argv)
 Translate the arguments of genreflex into rootcling ones and forward them to the RootCling function. More...
 
static void GetCurrentDirectory (std::string &output)
 
const char * GetExePath ()
 Returns the executable path name, used e.g. by SetRootSys(). More...
 
std::pair< std::string, std::string > GetExternalNamespaceAndContainedEntities (const std::string line)
 Performance is not critical here. More...
 
size_t GetFullArrayLength (const clang::ConstantArrayType *arrayType)
 
std::string GetFwdDeclnArgsToKeepString (const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, cling::Interpreter &interp)
 
void GetMostExternalEnclosingClassName (const clang::DeclContext &theContext, std::string &ctxtName, const cling::Interpreter &interpreter, bool treatParent=true)
 Extract the proper autoload key for nested classes The routine does not erase the name, just updates it. More...
 
void GetMostExternalEnclosingClassNameFromDecl (const clang::Decl &theDecl, std::string &ctxtName, const cling::Interpreter &interpreter)
 
string GetNonConstMemberName (const clang::FieldDecl &m, const string &prefix="")
 Return the name of the data member so that it can be used by non-const operation (so it includes a const_cast if necessary). More...
 
clang::QualType GetPointeeTypeIfPossible (const clang::QualType &qt)
 Get the pointee type if possible. More...
 
static std::string GetRelocatableHeaderName (const std::string &header, const std::string &currentDirectory)
 Convert to path relative to $PWD If that's not what the caller wants, she should pass -I to rootcling and a different relative path to the header files. More...
 
const std::string gLibraryExtension (".so")
 
const std::string gPathSeparator (ROOT::TMetaUtils::GetPathSeparator())
 
llvm::StringRef GrabIndex (const clang::FieldDecl &member, int printError)
 GrabIndex returns a static string (so use it or copy it immediately, do not call GrabIndex twice in the same expression) containing the size of the array data member. More...
 
bool HasPath (const std::string &name)
 Check if file has a path. More...
 
void genreflex::header2outputName (std::string &fileName)
 Replace the extension with "_rflx.cpp". More...
 
void genreflex::headers2outputsNames (const std::vector< std::string > &headersNames, std::vector< std::string > &ofilesnames)
 Get a proper name for the output file. More...
 
static bool IncludeHeaders (const std::vector< std::string > &headers, cling::Interpreter &interpreter)
 Includes all given headers in the interpreter. More...
 
bool InheritsFromTObject (const clang::RecordDecl *cl, const cling::Interpreter &interp)
 
bool InheritsFromTSelector (const clang::RecordDecl *cl, const cling::Interpreter &interp)
 
static bool InjectModuleUtilHeader (const char *argv0, TModuleGenerator &modGen, cling::Interpreter &interp, bool umbrella)
 Write the extra header injected into the module: umbrella header if (umbrella) else content header. More...
 
int genreflex::invokeManyRootCling (const std::string &verbosity, const std::string &selectionFileName, const std::string &targetLibName, bool multiDict, const std::vector< std::string > &pcmsNames, const std::vector< std::string > &includes, const std::vector< std::string > &preprocDefines, const std::vector< std::string > &preprocUndefines, const std::vector< std::string > &warnings, const std::string &rootmapFileName, const std::string &rootmapLibName, bool interpreteronly, bool doSplit, bool isDeep, bool isCxxmodule, bool writeEmptyRootPCM, bool selSyntaxOnly, bool noIncludePaths, const std::vector< std::string > &headersNames, bool failOnWarnings, const std::string &outputDirName_const="")
 Get the right ofilenames and invoke several times rootcling One invokation per header. More...
 
int genreflex::invokeRootCling (const std::string &verbosity, const std::string &selectionFileName, const std::string &targetLibName, bool multiDict, const std::vector< std::string > &pcmsNames, const std::vector< std::string > &includes, const std::vector< std::string > &preprocDefines, const std::vector< std::string > &preprocUndefines, const std::vector< std::string > &warnings, const std::string &rootmapFileName, const std::string &rootmapLibName, bool interpreteronly, bool doSplit, bool isDeep, bool isCxxmodule, bool writeEmptyRootPCM, bool selSyntaxOnly, bool noIncludePaths, const std::vector< std::string > &headersNames, bool failOnWarnings, const std::string &ofilename)
 
bool IsCorrectClingArgument (const std::string &argument)
 Check if the argument is a sane cling argument. More...
 
bool IsGoodForAutoParseMap (const clang::RecordDecl &rcd)
 Check if the class good for being an autoparse key. More...
 
bool IsGoodLibraryName (const std::string &name)
 
bool IsImplementationName (const std::string &filename)
 
bool IsLinkdefFile (const clang::PresumedLoc &PLoc)
 
bool isPointerToPointer (const clang::FieldDecl &m)
 
bool IsSelectionFile (const char *filename)
 
bool IsSelectionXml (const char *filename)
 
bool IsSupportedClassName (const char *name)
 
void LoadLibraryMap (const std::string &fileListName, map< string, string > &autoloads)
 Fill the map of libraries to be loaded in presence of a class Transparently support the old and new rootmap file format. More...
 
static bool ModuleContainsHeaders (TModuleGenerator &modGen, clang::Module *module, std::vector< std::string > &missingHeaders)
 Returns true iff a given module (and its submodules) contains all headers needed by the given ModuleGenerator. More...
 
bool Namespace__HasMethod (const clang::NamespaceDecl *cl, const char *name, const cling::Interpreter &interp)
 
bool NeedsSelection (const char *name)
 
bool ParsePragmaLine (const std::string &line, const char *expectedTokens[], size_t *end=0)
 Check whether the #pragma line contains expectedTokens (0-terminated array). More...
 
void ParseRootMapFile (ifstream &file, map< string, string > &autoloads)
 Parse the rootmap and add entries to the autoload map. More...
 
void ParseRootMapFileNewFormat (ifstream &file, map< string, string > &autoloads)
 Parse the rootmap and add entries to the autoload map, using the new format. More...
 
bool ProcessAndAppendIfNotThere (const std::string &el, std::list< std::string > &el_list, std::unordered_set< std::string > &el_set)
 Separate multiline strings. More...
 
std::list< std::string > RecordDecl2Headers (const clang::CXXRecordDecl &rcd, const cling::Interpreter &interp, std::set< const clang::CXXRecordDecl * > &visitedDecls)
 Extract the list of headers necessary for the Decl. More...
 
void RecordDeclCallback (const clang::RecordDecl *recordDecl)
 
void RiseWarningIfPresent (std::vector< ROOT::option::Option > &options, int optionIndex, const char *descriptor)
 
int ROOT_rootcling_Driver (int argc, char **argv, const ROOT::Internal::RootCling::DriverConfig &config)
 
int RootClingMain (int argc, char **argv, bool isDeep=false, bool isGenreflex=false)
 
void SetRootSys ()
 Set the ROOTSYS env var based on the executable location. More...
 
int ShouldIgnoreClingArgument (const std::string &argument)
 Returns >0 if argument is to be ignored. More...
 
int STLContainerStreamer (const clang::FieldDecl &m, int rwmode, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, std::ostream &dictStream)
 Create Streamer code for an STL container. More...
 
int STLStringStreamer (const clang::FieldDecl &m, int rwmode, std::ostream &dictStream)
 Create Streamer code for a standard string object. More...
 
void StrcpyArg (string &dest, const char *original)
 Copy the command line argument, stripping MODULE/inc if necessary. More...
 
char * genreflex::string2charptr (const std::string &str)
 The caller is responsible for deleting the string! More...
 
bool Which (cling::Interpreter &interp, const char *fname, string &pname)
 Find file name in path specified via -I statements to Cling. More...
 
void WriteArrayDimensions (const clang::QualType &type, std::ostream &dictStream)
 Write "[0]" for all but the 1st dimension. More...
 
static bool WriteAST (StringRef fileName, clang::CompilerInstance *compilerInstance, StringRef iSysRoot, clang::Module *module=nullptr)
 Write the AST of the given CompilerInstance to the given File while respecting the given isysroot. More...
 
void WriteAutoStreamer (const ROOT::TMetaUtils::AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, std::ostream &dictStream)
 
void WriteClassFunctions (const clang::CXXRecordDecl *cl, std::ostream &dictStream, bool autoLoad=false)
 Write the code to set the class name and the initialization object. More...
 
void WriteNamespaceInit (const clang::NamespaceDecl *cl, cling::Interpreter &interp, std::ostream &dictStream)
 Write the code to initialize the namespace name and the initialization object. More...
 
void WriteStreamer (const ROOT::TMetaUtils::AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, std::ostream &dictStream)
 

Variables

map< string, string > gAutoloads
 
bool gBuildingROOT = false
 
const ROOT::Internal::RootCling::DriverConfiggDriverConfig = nullptr
 
string gLibsNeeded
 
const char * shortHelp
 
bool genreflex::verbose = false
 

Macro Definition Documentation

◆ ENUM_LANGOPT

#define ENUM_LANGOPT (   Name,
  Type,
  Bits,
  Default,
  Description 
)

◆ LANGOPT

#define LANGOPT (   Name,
  Bits,
  Default,
  Description 
)     ROOT::TMetaUtils::Info(0, "%s = %d // %s\n", #Name, (int)LangOpts.Name, Description);

Typedef Documentation

◆ HeadersDeclsMap_t

using HeadersDeclsMap_t = std::map<std::string, std::list<std::string> >

Definition at line 141 of file rootcling_impl.cxx.

Function Documentation

◆ AddPlatformDefines()

void AddPlatformDefines ( std::vector< std::string > &  clingArgs)

Definition at line 2204 of file rootcling_impl.cxx.

◆ AdjustRootMapNames()

void AdjustRootMapNames ( std::string &  rootmapFileName,
std::string &  rootmapLibName 
)

Definition at line 2308 of file rootcling_impl.cxx.

◆ AnnotateAllDeclsForPCH()

void AnnotateAllDeclsForPCH ( cling::Interpreter &  interp,
RScanner scan 
)

We need annotations even in the PCH: // !, // || etc.

Definition at line 2752 of file rootcling_impl.cxx.

◆ AnnotateDecl()

void AnnotateDecl ( clang::CXXRecordDecl &  CXXRD,
const RScanner::DeclsSelRulesMap_t declSelRulesMap,
cling::Interpreter &  interpreter,
bool  isGenreflex 
)

Definition at line 378 of file rootcling_impl.cxx.

◆ AnnotateFieldDecl()

void AnnotateFieldDecl ( clang::FieldDecl &  decl,
const std::list< VariableSelectionRule > &  fieldSelRules,
bool  isGenreflex 
)

Definition at line 301 of file rootcling_impl.cxx.

◆ CallWriteStreamer()

void CallWriteStreamer ( const ROOT::TMetaUtils::AnnotatedRecordDecl &  cl,
const cling::Interpreter &  interp,
const ROOT::TMetaUtils::TNormalizedCtxt &  normCtxt,
std::ostream &  dictStream,
bool  isAutoStreamer 
)

Definition at line 1887 of file rootcling_impl.cxx.

◆ CheckClassDef()

bool CheckClassDef ( const clang::RecordDecl &  cl,
const cling::Interpreter &  interp 
)

Return false if the class does not have ClassDef even-though it should.

Definition at line 854 of file rootcling_impl.cxx.

◆ CheckClassesForInterpreterOnlyDicts()

int CheckClassesForInterpreterOnlyDicts ( cling::Interpreter &  interp,
RScanner scan 
)

Definition at line 2767 of file rootcling_impl.cxx.

◆ CheckClassNameForRootMap()

void CheckClassNameForRootMap ( const std::string &  classname,
map< string, string > &  autoloads 
)

Definition at line 648 of file rootcling_impl.cxx.

◆ CheckForMinusW()

void CheckForMinusW ( const char *  arg,
std::list< std::string > &  diagnosticPragmas 
)

Transform -W statements in diagnostic pragmas for cling reacting on "-Wno-" For example -Wno-deprecated-declarations --> #pragma clang diagnostic ignored "-Wdeprecated-declarations".

Definition at line 3164 of file rootcling_impl.cxx.

◆ CheckForUnsupportedClasses()

int CheckForUnsupportedClasses ( const RScanner::ClassColl_t annotatedRcds)

Check if the list of selected classes contains any class which is not supported.

Return the number of unsupported classes in the selection.

Definition at line 3609 of file rootcling_impl.cxx.

◆ CheckInputOperator() [1/2]

bool CheckInputOperator ( const char *  what,
const char *  proto,
const string &  fullname,
const clang::RecordDecl *  cl,
cling::Interpreter &  interp 
)

Check if the specified operator (what) has been properly declared if the user has requested a custom version.

Definition at line 781 of file rootcling_impl.cxx.

◆ CheckInputOperator() [2/2]

bool CheckInputOperator ( const clang::RecordDecl *  cl,
cling::Interpreter &  interp 
)

Check if the operator>> has been properly declared if the user has requested a custom version.

Definition at line 831 of file rootcling_impl.cxx.

◆ CheckModuleValid()

static bool CheckModuleValid ( TModuleGenerator modGen,
const std::string &  resourceDir,
cling::Interpreter &  interpreter,
StringRef  LinkdefPath,
const std::string &  moduleName 
)
static

Check moduleName validity from modulemap. Check if this module is defined or not.

Definition at line 2155 of file rootcling_impl.cxx.

◆ CollapseIdenticalNamespaces()

std::list< std::string > CollapseIdenticalNamespaces ( const std::list< std::string > &  fwdDeclarationsList)

If two identical namespaces are there, just declare one only Example: namespace A { namespace B { fwd1; }} namespace A { namespace B { fwd2; }} get a namespace A { namespace B { fwd1; fwd2; }} line.

Definition at line 2513 of file rootcling_impl.cxx.

◆ CopyArg()

const char * CopyArg ( const char *  original)

If the argument starts with MODULE/inc, strip it to make it the name we can use in #includes.

Definition at line 2004 of file rootcling_impl.cxx.

◆ CreateDictHeader()

void CreateDictHeader ( std::ostream &  dictStream,
const std::string &  main_dictname 
)

Definition at line 2953 of file rootcling_impl.cxx.

◆ CreateNewRootMapFile()

int CreateNewRootMapFile ( const std::string &  rootmapFileName,
const std::string &  rootmapLibName,
const std::list< std::string > &  classesDefsList,
const std::list< std::string > &  classesNames,
const std::list< std::string > &  nsNames,
const std::list< std::string > &  tdNames,
const std::list< std::string > &  enNames,
const std::list< std::string > &  varNames,
const HeadersDeclsMap_t headersClassesMap,
const std::unordered_set< std::string >  headersToIgnore 
)

Generate a rootmap file in the new format, like { decls } namespace A { namespace B { template <typename T> class myTemplate; } } [libGpad.so libGraf.so libHist.so libMathCore.so] class TAttCanvas class TButton (header1.h header2.h .

. headerN.h) class TMyClass

Definition at line 2384 of file rootcling_impl.cxx.

◆ CreateStreamPtrForSplitDict()

std::ostream * CreateStreamPtrForSplitDict ( const std::string &  dictpathname,
tempFileNamesCatalog &  tmpCatalog 
)

Transform name of dictionary.

Definition at line 3149 of file rootcling_impl.cxx.

◆ EmitEnums()

static void EmitEnums ( const std::vector< const clang::EnumDecl * > &  enumvec)
static

Definition at line 176 of file rootcling_impl.cxx.

◆ EmitStreamerInfo()

void EmitStreamerInfo ( const char *  normName)

Definition at line 164 of file rootcling_impl.cxx.

◆ EmitTypedefs()

static void EmitTypedefs ( const std::vector< const clang::TypedefNameDecl * > &  tdvec)
static

Definition at line 169 of file rootcling_impl.cxx.

◆ ExtractAutoloadKeys()

template<class COLL >
int ExtractAutoloadKeys ( std::list< std::string > &  names,
const COLL &  decls,
const cling::Interpreter &  interp 
)

Definition at line 2356 of file rootcling_impl.cxx.

◆ ExtractClassesListAndDeclLines()

int ExtractClassesListAndDeclLines ( RScanner scan,
std::list< std::string > &  classesList,
std::list< std::string > &  classesListForRootmap,
std::list< std::string > &  fwdDeclarationsList,
const cling::Interpreter &  interpreter 
)

Definition at line 2568 of file rootcling_impl.cxx.

◆ ExtractFileName()

std::string ExtractFileName ( const std::string &  path)

Extract the filename from a fullpath.

Definition at line 2277 of file rootcling_impl.cxx.

◆ ExtractFilePath()

void ExtractFilePath ( const std::string &  path,
std::string &  dirname 
)

Extract the path from a fullpath finding the last \ or / according to the content in gPathSeparator.

Definition at line 2286 of file rootcling_impl.cxx.

◆ ExtractHeadersForDecls()

void ExtractHeadersForDecls ( const RScanner::ClassColl_t annotatedRcds,
const RScanner::TypedefColl_t  tDefDecls,
const RScanner::FunctionColl_t  funcDecls,
const RScanner::VariableColl_t  varDecls,
const RScanner::EnumColl_t  enumDecls,
HeadersDeclsMap_t headersClassesMap,
HeadersDeclsMap_t headersDeclsMap,
const cling::Interpreter &  interp 
)

Definition at line 3355 of file rootcling_impl.cxx.

◆ extractMultipleOptions()

int extractMultipleOptions ( std::vector< ROOT::option::Option > &  options,
int  oIndex,
std::vector< std::string > &  values 
)

Extract from options multiple values with the same option.

Definition at line 5398 of file rootcling_impl.cxx.

◆ ExtractSelectedNamespaces()

void ExtractSelectedNamespaces ( RScanner scan,
std::list< std::string > &  nsList 
)

Loop on selected classes and put them in a list.

Definition at line 2741 of file rootcling_impl.cxx.

◆ FinalizeStreamerInfoWriting()

int FinalizeStreamerInfoWriting ( cling::Interpreter &  interp,
bool  writeEmptyRootPCM = false 
)

Make up for skipping RegisterModule, now that dictionary parsing is done and these headers cannot be selected anymore.

Definition at line 2788 of file rootcling_impl.cxx.

◆ GenerateAllDict()

static bool GenerateAllDict ( TModuleGenerator modGen,
clang::CompilerInstance *  compilerInstance,
const std::string &  currentDirectory 
)
static

Generates a PCH from the given ModuleGenerator and CompilerInstance.

Returns true iff the PCH was successfully generated.

Definition at line 2097 of file rootcling_impl.cxx.

◆ GenerateFullDict()

int GenerateFullDict ( std::ostream &  dictStream,
cling::Interpreter &  interp,
RScanner scan,
const ROOT::TMetaUtils::RConstructorTypes &  ctorTypes,
bool  isSplit,
bool  isGenreflex,
bool  writeEmptyRootPCM 
)

Definition at line 2821 of file rootcling_impl.cxx.

◆ GenerateFwdDeclString()

std::string GenerateFwdDeclString ( const RScanner scan,
const cling::Interpreter &  interp 
)

Generate the fwd declarations of the selected entities.

Definition at line 3438 of file rootcling_impl.cxx.

◆ GenerateLinkdef()

void GenerateLinkdef ( int *  argc,
char **  argv,
int  firstInputFile,
std::string &  code_for_parser 
)

Definition at line 1902 of file rootcling_impl.cxx.

◆ GenerateNecessaryIncludes()

void GenerateNecessaryIncludes ( std::ostream &  dictStream,
const std::string &  includeForSource,
const std::string &  extraIncludes 
)

Definition at line 2999 of file rootcling_impl.cxx.

◆ GenerateStringFromHeadersForClasses()

const std::string GenerateStringFromHeadersForClasses ( const HeadersDeclsMap_t headersClassesMap,
const std::string &  detectedUmbrella,
bool  payLoadOnly = false 
)

Generate a string for the dictionary from the headers-classes map.

Definition at line 3508 of file rootcling_impl.cxx.

◆ GenReflexMain()

int GenReflexMain ( int  argc,
char **  argv 
)

Translate the arguments of genreflex into rootcling ones and forward them to the RootCling function.

These are two typical genreflex and rootcling commandlines 1) genreflex header1.h [header2.h ...] [options] [preprocessor options] 2) rootcling [-v] [-v0-4] [-f] [out.cxx] [-s sharedlib.so] [-m pcmfilename] header1.h[{+,-}][!] ..headerN.h[{+,-}][!] [{LinkDef.h,selectionRules.xml}] The rules with which the arguments are translated are (1st column genreflex): –debug -v4 –quiet -v0 -o ofile positional arg after -f -s selection file Last argument of the call –fail_on_warning Wrap ROOT::TMetaUtils::Warning and throw if selected

New arguments: -l –library targetLib name (new) -s targetLib name -m pcmname (can be many -m) (new) -m pcmname (can be many -m) –rootmap -rmf (new) –rootmap-lib -rml (new)

genreflex options which rise warnings (feedback is desirable) –no_membertypedefs (it should be irrelevant) –no_templatetypedefs (it should be irrelevant)

genreflex options which are ignored (know for sure they are not needed) –pool, –dataonly –interpreteronly –gccxml{path,opt,post} –reflex

Exceptions The –deep option of genreflex is passed as function parameter to rootcling since it's not needed at the moment there.

Definition at line 5480 of file rootcling_impl.cxx.

◆ GetCurrentDirectory()

static void GetCurrentDirectory ( std::string &  output)
static

Definition at line 191 of file rootcling_impl.cxx.

◆ GetExePath()

const char * GetExePath ( )

Returns the executable path name, used e.g. by SetRootSys().

Definition at line 228 of file rootcling_impl.cxx.

◆ GetExternalNamespaceAndContainedEntities()

std::pair< std::string, std::string > GetExternalNamespaceAndContainedEntities ( const std::string  line)

Performance is not critical here.

Definition at line 2489 of file rootcling_impl.cxx.

◆ GetFullArrayLength()

size_t GetFullArrayLength ( const clang::ConstantArrayType *  arrayType)

Definition at line 476 of file rootcling_impl.cxx.

◆ GetFwdDeclnArgsToKeepString()

std::string GetFwdDeclnArgsToKeepString ( const ROOT::TMetaUtils::TNormalizedCtxt &  normCtxt,
cling::Interpreter &  interp 
)

Definition at line 3183 of file rootcling_impl.cxx.

◆ GetMostExternalEnclosingClassName()

void GetMostExternalEnclosingClassName ( const clang::DeclContext &  theContext,
std::string &  ctxtName,
const cling::Interpreter &  interpreter,
bool  treatParent = true 
)

Extract the proper autoload key for nested classes The routine does not erase the name, just updates it.

Definition at line 2328 of file rootcling_impl.cxx.

◆ GetMostExternalEnclosingClassNameFromDecl()

void GetMostExternalEnclosingClassNameFromDecl ( const clang::Decl &  theDecl,
std::string &  ctxtName,
const cling::Interpreter &  interpreter 
)

Definition at line 2346 of file rootcling_impl.cxx.

◆ GetNonConstMemberName()

string GetNonConstMemberName ( const clang::FieldDecl &  m,
const string &  prefix = "" 
)

Return the name of the data member so that it can be used by non-const operation (so it includes a const_cast if necessary).

Definition at line 883 of file rootcling_impl.cxx.

◆ GetPointeeTypeIfPossible()

clang::QualType GetPointeeTypeIfPossible ( const clang::QualType &  qt)

Get the pointee type if possible.

Definition at line 3207 of file rootcling_impl.cxx.

◆ GetRelocatableHeaderName()

static std::string GetRelocatableHeaderName ( const std::string &  header,
const std::string &  currentDirectory 
)
static

Convert to path relative to $PWD If that's not what the caller wants, she should pass -I to rootcling and a different relative path to the header files.

Definition at line 269 of file rootcling_impl.cxx.

◆ gLibraryExtension()

const std::string gLibraryExtension ( ".so"  )

◆ gPathSeparator()

const std::string gPathSeparator ( ROOT::TMetaUtils::GetPathSeparator()  )

◆ GrabIndex()

llvm::StringRef GrabIndex ( const clang::FieldDecl &  member,
int  printError 
)

GrabIndex returns a static string (so use it or copy it immediately, do not call GrabIndex twice in the same expression) containing the size of the array data member.

In case of error, or if the size is not specified, GrabIndex returns 0.

Definition at line 1407 of file rootcling_impl.cxx.

◆ HasPath()

bool HasPath ( const std::string &  name)

Check if file has a path.

Definition at line 2299 of file rootcling_impl.cxx.

◆ IncludeHeaders()

static bool IncludeHeaders ( const std::vector< std::string > &  headers,
cling::Interpreter &  interpreter 
)
static

Includes all given headers in the interpreter.

Returns true when we could include the headers and otherwise false on an error when including.

Definition at line 2110 of file rootcling_impl.cxx.

◆ InheritsFromTObject()

bool InheritsFromTObject ( const clang::RecordDecl *  cl,
const cling::Interpreter &  interp 
)

Definition at line 488 of file rootcling_impl.cxx.

◆ InheritsFromTSelector()

bool InheritsFromTSelector ( const clang::RecordDecl *  cl,
const cling::Interpreter &  interp 
)

Definition at line 500 of file rootcling_impl.cxx.

◆ InjectModuleUtilHeader()

static bool InjectModuleUtilHeader ( const char *  argv0,
TModuleGenerator modGen,
cling::Interpreter &  interp,
bool  umbrella 
)
static

Write the extra header injected into the module: umbrella header if (umbrella) else content header.

Definition at line 2033 of file rootcling_impl.cxx.

◆ IsCorrectClingArgument()

bool IsCorrectClingArgument ( const std::string &  argument)

Check if the argument is a sane cling argument.

Performing the following checks: 1) It does not start with "--" and is not the –param option.

Definition at line 3569 of file rootcling_impl.cxx.

◆ IsGoodForAutoParseMap()

bool IsGoodForAutoParseMap ( const clang::RecordDecl &  rcd)

Check if the class good for being an autoparse key.

We exclude from this set stl containers of pods/strings TODO: we may use also __gnu_cxx::

Definition at line 3305 of file rootcling_impl.cxx.

◆ IsGoodLibraryName()

bool IsGoodLibraryName ( const std::string &  name)

Definition at line 5434 of file rootcling_impl.cxx.

◆ IsImplementationName()

bool IsImplementationName ( const std::string &  filename)

Definition at line 3540 of file rootcling_impl.cxx.

◆ IsLinkdefFile()

bool IsLinkdefFile ( const clang::PresumedLoc &  PLoc)

Definition at line 524 of file rootcling_impl.cxx.

◆ isPointerToPointer()

bool isPointerToPointer ( const clang::FieldDecl &  m)

Definition at line 1206 of file rootcling_impl.cxx.

◆ IsSelectionFile()

bool IsSelectionFile ( const char *  filename)

Definition at line 531 of file rootcling_impl.cxx.

◆ IsSelectionXml()

bool IsSelectionXml ( const char *  filename)

Definition at line 511 of file rootcling_impl.cxx.

◆ IsSupportedClassName()

bool IsSupportedClassName ( const char *  name)

Definition at line 3589 of file rootcling_impl.cxx.

◆ LoadLibraryMap()

void LoadLibraryMap ( const std::string &  fileListName,
map< string, string > &  autoloads 
)

Fill the map of libraries to be loaded in presence of a class Transparently support the old and new rootmap file format.

Definition at line 745 of file rootcling_impl.cxx.

◆ ModuleContainsHeaders()

static bool ModuleContainsHeaders ( TModuleGenerator modGen,
clang::Module *  module,
std::vector< std::string > &  missingHeaders 
)
static

Returns true iff a given module (and its submodules) contains all headers needed by the given ModuleGenerator.

The names of all header files that are needed by the ModuleGenerator but are not in the given module will be inserted into the MissingHeader variable. Returns true iff the PCH was successfully generated.

Definition at line 2132 of file rootcling_impl.cxx.

◆ Namespace__HasMethod()

bool Namespace__HasMethod ( const clang::NamespaceDecl *  cl,
const char *  name,
const cling::Interpreter &  interp 
)

Definition at line 293 of file rootcling_impl.cxx.

◆ NeedsSelection()

bool NeedsSelection ( const char *  name)

Definition at line 3576 of file rootcling_impl.cxx.

◆ ParsePragmaLine()

bool ParsePragmaLine ( const std::string &  line,
const char *  expectedTokens[],
size_t *  end = 0 
)

Check whether the #pragma line contains expectedTokens (0-terminated array).

Definition at line 602 of file rootcling_impl.cxx.

◆ ParseRootMapFile()

void ParseRootMapFile ( ifstream &  file,
map< string, string > &  autoloads 
)

Parse the rootmap and add entries to the autoload map.

Definition at line 680 of file rootcling_impl.cxx.

◆ ParseRootMapFileNewFormat()

void ParseRootMapFileNewFormat ( ifstream &  file,
map< string, string > &  autoloads 
)

Parse the rootmap and add entries to the autoload map, using the new format.

Definition at line 711 of file rootcling_impl.cxx.

◆ ProcessAndAppendIfNotThere()

bool ProcessAndAppendIfNotThere ( const std::string &  el,
std::list< std::string > &  el_list,
std::unordered_set< std::string > &  el_set 
)

Separate multiline strings.

Definition at line 2548 of file rootcling_impl.cxx.

◆ RecordDecl2Headers()

std::list< std::string > RecordDecl2Headers ( const clang::CXXRecordDecl &  rcd,
const cling::Interpreter &  interp,
std::set< const clang::CXXRecordDecl * > &  visitedDecls 
)

Extract the list of headers necessary for the Decl.

Definition at line 3222 of file rootcling_impl.cxx.

◆ RecordDeclCallback()

void RecordDeclCallback ( const clang::RecordDecl *  recordDecl)

Definition at line 628 of file rootcling_impl.cxx.

◆ RiseWarningIfPresent()

void RiseWarningIfPresent ( std::vector< ROOT::option::Option > &  options,
int  optionIndex,
const char *  descriptor 
)

Definition at line 5421 of file rootcling_impl.cxx.

◆ ROOT_rootcling_Driver()

int ROOT_rootcling_Driver ( int  argc,
char **  argv,
const ROOT::Internal::RootCling::DriverConfig config 
)

Definition at line 6062 of file rootcling_impl.cxx.

◆ RootClingMain()

int RootClingMain ( int  argc,
char **  argv,
bool  isDeep = false,
bool  isGenreflex = false 
)

Definition at line 3772 of file rootcling_impl.cxx.

◆ SetRootSys()

void SetRootSys ( )

Set the ROOTSYS env var based on the executable location.

Definition at line 539 of file rootcling_impl.cxx.

◆ ShouldIgnoreClingArgument()

int ShouldIgnoreClingArgument ( const std::string &  argument)

Returns >0 if argument is to be ignored.

If 1, just skip that argument. If 2, that argument takes a parameter "-arg param" thus skip both.

Definition at line 3550 of file rootcling_impl.cxx.

◆ STLContainerStreamer()

int STLContainerStreamer ( const clang::FieldDecl &  m,
int  rwmode,
const cling::Interpreter &  interp,
const ROOT::TMetaUtils::TNormalizedCtxt &  normCtxt,
std::ostream &  dictStream 
)

Create Streamer code for an STL container.

Returns 1 if data member was an STL container and if Streamer code has been created, 0 otherwise.

Definition at line 908 of file rootcling_impl.cxx.

◆ STLStringStreamer()

int STLStringStreamer ( const clang::FieldDecl &  m,
int  rwmode,
std::ostream &  dictStream 
)

Create Streamer code for a standard string object.

Returns 1 if data member was a standard string and if Streamer code has been created, 0 otherwise.

Definition at line 1143 of file rootcling_impl.cxx.

◆ StrcpyArg()

void StrcpyArg ( string &  dest,
const char *  original 
)

Copy the command line argument, stripping MODULE/inc if necessary.

Definition at line 2024 of file rootcling_impl.cxx.

◆ Which()

bool Which ( cling::Interpreter &  interp,
const char *  fname,
string &  pname 
)

Find file name in path specified via -I statements to Cling.

Return false if the file can not be found. If the file is found, set pname to the full path name and return true.

Definition at line 1964 of file rootcling_impl.cxx.

◆ WriteArrayDimensions()

void WriteArrayDimensions ( const clang::QualType &  type,
std::ostream &  dictStream 
)

Write "[0]" for all but the 1st dimension.

Definition at line 1219 of file rootcling_impl.cxx.

◆ WriteAST()

static bool WriteAST ( StringRef  fileName,
clang::CompilerInstance *  compilerInstance,
StringRef  iSysRoot,
clang::Module *  module = nullptr 
)
static

Write the AST of the given CompilerInstance to the given File while respecting the given isysroot.

If module is not a null pointer, we only write the given module to the given file and not the whole AST. Returns true if the AST was successfully written.

Definition at line 2062 of file rootcling_impl.cxx.

◆ WriteAutoStreamer()

void WriteAutoStreamer ( const ROOT::TMetaUtils::AnnotatedRecordDecl &  cl,
const cling::Interpreter &  interp,
const ROOT::TMetaUtils::TNormalizedCtxt &  normCtxt,
std::ostream &  dictStream 
)

Definition at line 1835 of file rootcling_impl.cxx.

◆ WriteClassFunctions()

void WriteClassFunctions ( const clang::CXXRecordDecl *  cl,
std::ostream &  dictStream,
bool  autoLoad = false 
)

Write the code to set the class name and the initialization object.

Definition at line 1234 of file rootcling_impl.cxx.

◆ WriteNamespaceInit()

void WriteNamespaceInit ( const clang::NamespaceDecl *  cl,
cling::Interpreter &  interp,
std::ostream &  dictStream 
)

Write the code to initialize the namespace name and the initialization object.

Definition at line 1312 of file rootcling_impl.cxx.

◆ WriteStreamer()

void WriteStreamer ( const ROOT::TMetaUtils::AnnotatedRecordDecl &  cl,
const cling::Interpreter &  interp,
const ROOT::TMetaUtils::TNormalizedCtxt &  normCtxt,
std::ostream &  dictStream 
)

Definition at line 1445 of file rootcling_impl.cxx.

Variable Documentation

◆ gAutoloads

map<string, string> gAutoloads

Definition at line 623 of file rootcling_impl.cxx.

◆ gBuildingROOT

bool gBuildingROOT = false

Definition at line 127 of file rootcling_impl.cxx.

◆ gDriverConfig

const ROOT::Internal::RootCling::DriverConfig* gDriverConfig = nullptr

Definition at line 128 of file rootcling_impl.cxx.

◆ gLibsNeeded

string gLibsNeeded

Definition at line 624 of file rootcling_impl.cxx.

◆ shortHelp

const char* shortHelp
Initial value:
=
"Usage: rootcling [-v][-v0-4] [-f] [out.cxx] [opts] "
"file1.h[+][-][!] file2.h[+][-][!] ...[LinkDef.h]\n"

Definition at line 11 of file rootcling_impl.cxx.