Logo ROOT  
Reference Guide
LinkdefReader.h
Go to the documentation of this file.
1 // @(#)root/core/utils:$Id: LinkdefReader.h 28529 2009-05-11 16:43:35Z pcanal $
2 // Author: Velislava Spasova September 2010
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2011, Rene Brun, Fons Rademakers and al. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef R__LINKDEFREADER_H
13 #define R__LINKDEFREADER_H
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // LinkdefReader //
18 // //
19 // Linkdef.h parsing class //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include <fstream>
24 #include <vector>
25 #include <string>
26 #include <map>
27 #include "llvm/ADT/StringRef.h"
28 
29 #include "TClingUtils.h"
30 
31 namespace cling {
32  class Interpreter;
33 }
34 
35 class SelectionRules;
36 class PragmaCreateCollector;
37 class PragmaLinkCollector;
38 class LinkdefReaderPragmaHandler;
39 class PragmaExtraInclude;
40 
42 
43 public:
44  LinkdefReader(cling::Interpreter &interp,
45  ROOT::TMetaUtils::RConstructorTypes &IOConstructorTypes);
46 
47  bool LoadIncludes(std::string &extraInclude);
48  bool Parse(SelectionRules &sr, llvm::StringRef code, const std::vector<std::string> &parserArgs, const char *llvmdir);
49 
50 
51 private:
52 
53  friend class PragmaCreateCollector;
54  friend class PragmaLinkCollector;
56  friend class PragmaExtraInclude;
57 
58  long fLine; // lines count - for error messages
59  long fCount; // Number of rules created so far.
60  SelectionRules *fSelectionRules; // set of rules being filleed.
61  std::string fIncludes; // Extra set of file to be included by the intepreter.
62  ROOT::TMetaUtils::RConstructorTypes *fIOConstructorTypesPtr; // List of values of #pragma ioctortype
63  cling::Interpreter &fInterp; // Our interpreter
64 
65  enum EPragmaNames { // the processed pragma attributes
81  };
82 
83  enum ECppNames { // the processes pre-processor directives
87  kIf,
90  };
91 
92  // used to create string to tag kind association to use in switch constructions
93  static std::map<std::string, EPragmaNames> fgMapPragmaNames;
94  static std::map<std::string, ECppNames> fgMapCppNames;
95 
96  static void PopulatePragmaMap();
97  static void PopulateCppMap();
98 
99  struct Options;
100 
101  bool AddInclude(const std::string& include);
102  bool AddRule(const std::string& ruletype,
103  const std::string& identifier,
104  bool linkOn,
105  bool requestOnlyTClass,
106  Options *option = 0);
107 
108  bool ProcessFunctionPrototype(std::string &proto, bool &name); // transforms the function prototypes to a more unified form
109  bool ProcessOperators(std::string &pattern); // transforms the operators statement to the suitable function pattern
110 
111  bool IsPatternRule(const std::string &rule_token); // is it name or pattern
112 };
113 
114 #endif
115 
LinkdefReader::kUnion
@ kUnion
Definition: LinkdefReader.h:75
LinkdefReader::PopulateCppMap
static void PopulateCppMap()
Definition: LinkdefReader.cxx:90
LinkdefReader::kFunction
@ kFunction
Definition: LinkdefReader.h:70
LinkdefReader::kNestedclasses
@ kNestedclasses
Definition: LinkdefReader.h:67
LinkdefReader::fIOConstructorTypesPtr
ROOT::TMetaUtils::RConstructorTypes * fIOConstructorTypesPtr
Definition: LinkdefReader.h:62
LinkdefReader::fLine
long fLine
Definition: LinkdefReader.h:58
LinkdefReader::EPragmaNames
EPragmaNames
Definition: LinkdefReader.h:65
LinkdefReader::PopulatePragmaMap
static void PopulatePragmaMap()
Definition: LinkdefReader.cxx:64
LinkdefReader::PragmaExtraInclude
friend class PragmaExtraInclude
Definition: LinkdefReader.h:56
LinkdefReader::kPragma
@ kPragma
Definition: LinkdefReader.h:84
LinkdefReader::kTypeDef
@ kTypeDef
Definition: LinkdefReader.h:73
LinkdefReader::kAll
@ kAll
Definition: LinkdefReader.h:66
LinkdefReader::fCount
long fCount
Definition: LinkdefReader.h:59
LinkdefReader::PragmaLinkCollector
friend class PragmaLinkCollector
Definition: LinkdefReader.h:54
LinkdefReader::fgMapPragmaNames
static std::map< std::string, EPragmaNames > fgMapPragmaNames
Definition: LinkdefReader.h:93
LinkdefReader::kOperators
@ kOperators
Definition: LinkdefReader.h:77
LinkdefReader::kClass
@ kClass
Definition: LinkdefReader.h:72
LinkdefReader::kElse
@ kElse
Definition: LinkdefReader.h:88
LinkdefReader::Parse
bool Parse(SelectionRules &sr, llvm::StringRef code, const std::vector< std::string > &parserArgs, const char *llvmdir)
Definition: LinkdefReader.cxx:1005
LinkdefReader::kUnknown
@ kUnknown
Definition: LinkdefReader.h:80
LinkdefReader::AddInclude
bool AddInclude(const std::string &include)
Definition: LinkdefReader.cxx:113
LinkdefReader::PragmaCreateCollector
friend class PragmaCreateCollector
Definition: LinkdefReader.h:53
LinkdefReader::IsPatternRule
bool IsPatternRule(const std::string &rule_token)
Definition: LinkdefReader.cxx:497
LinkdefReader::kIfdef
@ kIfdef
Definition: LinkdefReader.h:85
LinkdefReader::kStruct
@ kStruct
Definition: LinkdefReader.h:76
LinkdefReader::AddRule
bool AddRule(const std::string &ruletype, const std::string &identifier, bool linkOn, bool requestOnlyTClass, Options *option=0)
Definition: LinkdefReader.cxx:127
TGeant4Unit::sr
static constexpr double sr
Definition: TGeant4SystemOfUnits.h:150
LinkdefReader::ECppNames
ECppNames
Definition: LinkdefReader.h:83
LinkdefReader::fgMapCppNames
static std::map< std::string, ECppNames > fgMapCppNames
Definition: LinkdefReader.h:94
LinkdefReader::kEndif
@ kEndif
Definition: LinkdefReader.h:86
LinkdefReader::kEnum
@ kEnum
Definition: LinkdefReader.h:71
LinkdefReader::kIf
@ kIf
Definition: LinkdefReader.h:87
LinkdefReader::ProcessFunctionPrototype
bool ProcessFunctionPrototype(std::string &proto, bool &name)
Definition: LinkdefReader.cxx:514
LinkdefReader::fIncludes
std::string fIncludes
Definition: LinkdefReader.h:61
LinkdefReader::kIOCtorType
@ kIOCtorType
Definition: LinkdefReader.h:78
proto
const char * proto
Definition: civetweb.c:16604
LinkdefReader::LoadIncludes
bool LoadIncludes(std::string &extraInclude)
Definition: LinkdefReader.cxx:508
LinkdefReader::ProcessOperators
bool ProcessOperators(std::string &pattern)
Definition: LinkdefReader.cxx:569
LinkdefReader::kNamespace
@ kNamespace
Definition: LinkdefReader.h:74
LinkdefReader::fSelectionRules
SelectionRules * fSelectionRules
Definition: LinkdefReader.h:60
LinkdefReader::LinkdefReaderPragmaHandler
friend class LinkdefReaderPragmaHandler
Definition: LinkdefReader.h:55
name
char name[80]
Definition: TGX11.cxx:110
LinkdefReader::LinkdefReader
LinkdefReader(cling::Interpreter &interp, ROOT::TMetaUtils::RConstructorTypes &IOConstructorTypes)
Definition: LinkdefReader.cxx:101
LinkdefReader::kUnrecognized
@ kUnrecognized
Definition: LinkdefReader.h:89
TClingUtils.h
LinkdefReader::fInterp
cling::Interpreter & fInterp
Definition: LinkdefReader.h:63
LinkdefReader::kIgnore
@ kIgnore
Definition: LinkdefReader.h:79
LinkdefReader::kDefinedIn
@ kDefinedIn
Definition: LinkdefReader.h:68
ROOT::TMetaUtils::RConstructorTypes
std::list< RConstructorType > RConstructorTypes
Definition: TClingUtils.h:321
LinkdefReader::kGlobal
@ kGlobal
Definition: LinkdefReader.h:69
ROOT::TMetaUtils::propNames::pattern
static const std::string pattern("pattern")
SelectionRules
Definition: SelectionRules.h:92
LinkdefReader
Definition: LinkdefReader.h:41