24#define fnmatch(glob, path, dummy) PathMatchSpecA(path, glob); 
   28#include "llvm/Support/raw_ostream.h" 
   29#include "clang/Basic/SourceLocation.h" 
   30#include "clang/Basic/SourceManager.h" 
   31#include "clang/AST/ASTContext.h" 
   32#include "clang/AST/DeclCXX.h" 
   33#include "clang/AST/DeclTemplate.h" 
   35#include "cling/Interpreter/Interpreter.h" 
   63   if (!
varSel.HasInterpreter())
 
 
   81   std::cout<<
"Printing Selection Rules:"<<std::endl;
 
   86         std::cout<<
"\tClass sel rule "<<i<<
":"<<std::endl;
 
   91      std::cout<<
"\tNo Class Selection Rules"<<std::endl;
 
   96      std::list<FunctionSelectionRule>::const_iterator 
it2;
 
  100         std::cout<<
"\tFunction sel rule "<<i<<
":"<<std::endl;
 
  101         std::cout<<
"\t\tSelected: ";
 
  102         switch(
it2->GetSelected()){
 
  109            default: std::cout<<
"Unspecified"<<std::endl;
 
  111         it2->PrintAttributes(std::cout,2);
 
  115      std::cout<<
"\tNo function sel rules"<<std::endl;
 
  119      std::list<VariableSelectionRule>::const_iterator 
it3;
 
  123         std::cout<<
"\tVariable sel rule "<<i<<
":"<<std::endl;
 
  124         std::cout<<
"\t\tSelected: ";
 
  125         switch(
it3->GetSelected()){
 
  132            default: std::cout<<
"Unspecified"<<std::endl;
 
  134         it3->PrintAttributes(std::cout,2);
 
  138      std::cout<<
"\tNo variable sel rules"<<std::endl;
 
  142      std::list<EnumSelectionRule>::const_iterator 
it4;
 
  146         std::cout<<
"\tEnum sel rule "<<i<<
":"<<std::endl;
 
  147         std::cout<<
"\t\tSelected: ";
 
  148         switch(
it4->GetSelected()){
 
  155            default: std::cout<<
"Unspecified"<<std::endl;
 
  157         it4->PrintAttributes(std::cout,2);
 
  161      std::cout<<
"\tNo enum sel rules"<<std::endl;
 
 
  175                         std::unordered_map<std::string,RULE*>& 
storedRules,
 
  185   std::stringstream 
sstr; 
sstr << 
"Rule:\n";
 
  187   sstr << (areEqual ? 
"Identical " : 
"Conflicting ");
 
  188   sstr << 
"rule already stored:\n";
 
  191                             "Duplicated rule found.\n%s",
sstr.str().c_str());
 
 
  195template<
class RULESCOLLECTION, 
class RULE = 
typename RULESCOLLECTION::value_type>
 
  198   std::unordered_map<std::string, RULE*> 
patterns,names;
 
 
  215            "Duplicates in rules were found.\n");
 
 
  233   auto pattern = 
patternRule.GetAttributePattern().c_str();
 
  240      static const auto msg = 
"The pattern rule %s matches the name rule %s. " 
  241      "Since the name rule has compatible attributes, " 
  242      "it will be removed: the pattern rule will match the necessary classes if needed.\n";
 
 
  261     if (
rule.HasAttributeName()) {
 
 
  306#if defined(R__MUST_REVISIT) 
  307# if R__MUST_REVISIT(6,4) 
  308   "Can become no-op once PCMs are available." 
 
  376   clang::Decl::Kind 
declkind = D->getKind();
 
  379   case clang::Decl::CXXRecord:
 
  380   case clang::Decl::ClassTemplateSpecialization:
 
  381   case clang::Decl::ClassTemplatePartialSpecialization:
 
  384   case clang::Decl::Namespace:
 
  386   case clang::Decl::Enum:
 
  389   case clang::Decl::Var:
 
  391#if ROOTCLING_NEEDS_FUNCTIONS_SELECTION 
  392   case clang::Decl::Function:
 
  394   case clang::Decl::CXXMethod:
 
  395   case clang::Decl::CXXConstructor:
 
  396   case clang::Decl::CXXDestructor: {
 
  411   case clang::Decl::Field:
 
 
  427   const clang::NamedDecl* 
N = llvm::dyn_cast<clang::NamedDecl> (D);
 
  433   if (
N->getIdentifier() || 
N->isCXXClassMember()) {
 
  434      name = 
N->getNameAsString();
 
  435      llvm::raw_string_ostream stream(
qual_name);
 
  436      N->getNameForDiagnostic(stream,
N->getASTContext().getPrintingPolicy(),
true);
 
 
  443   const clang::NamedDecl* 
N = 
static_cast<const clang::NamedDecl*
> (D);
 
  444   llvm::raw_string_ostream stream(
qual_name);
 
  446      N->getNameForDiagnostic(stream,
N->getASTContext().getPrintingPolicy(),
true);
 
 
  456   const std::vector<std::string> 
quals={
"*",
"&"};
 
  461   for (
auto I = F->param_begin(), E = F->param_end(); 
I != E; ++
I) {
 
  463      clang::ParmVarDecl* P = *
I;
 
  479        if (pos != std::string::npos)
 
 
  501   if (
const clang::TagDecl *T = llvm::dyn_cast<clang::TagDecl>(
 
  502         D->getDeclContext()))
 
  503      return T->isClass() || T->isStruct();
 
 
  510   if (
const clang::TagDecl* parent
 
  511       = llvm::dyn_cast<clang::TagDecl>(D->getDeclContext())) {
 
  512      if (parent->isClass()|| parent->isStruct()) {
 
 
  522   if (
const clang::RecordDecl* parent
 
  523       = llvm::dyn_cast<clang::RecordDecl>(D->getDeclContext())) {
 
 
  570   const clang::NamespaceDecl* 
N = llvm::dyn_cast<clang::NamespaceDecl> (D); 
 
  572      std::cout<<
"\n\tCouldn't cast Decl to NamespaceDecl";
 
  611#ifdef SELECTION_DEBUG 
  612                  std::cout<<
"\tNo returned"<<std::endl;
 
  630#ifdef SELECTION_DEBUG 
  631            std::cout<<
"Empty dontC returned = No"<<std::endl;
 
  641#ifdef SELECTION_DEBUG 
  642      std::cout<<
"\n\tfYes = "<<fYes<<
", fImplNo = "<<
fImplNo<<std::endl;
 
  647      else if (
fImplNo > 0) 
return nullptr;
 
  648      else return selector;
 
  653#ifdef SELECTION_DEBUG 
  654      std::cout<<
"\n\tfYes = "<<fYes<<
", fFileNo = "<<
fFileNo<<std::endl;
 
 
  668   const clang::TagDecl* 
tagDecl = llvm::dyn_cast<clang::TagDecl> (D); 
 
  669   const clang::TypedefNameDecl* 
typeDefNameDecl = llvm::dyn_cast<clang::TypedefNameDecl> (D);
 
  673            "Cannot cast Decl to TagDecl and Decl is not a typedef.\n");
 
  681                                 "Cannot get RecordDecl behind TypedefDecl.\n");
 
  700   const clang::NamedDecl* 
nDecl(llvm::dyn_cast<clang::NamedDecl>(D));
 
  707         if (
const clang::ClassTemplateSpecializationDecl* 
ctsd =
 
  708         llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>(D))
 
  709            if(
const clang::ClassTemplateDecl* 
ctd = 
ctsd->getSpecializedTemplate()){
 
  710               const std::string& nArgsToKeep = 
rule.GetAttributeNArgsToKeep();
 
  711               if (!nArgsToKeep.empty()){
 
  713                                                   std::atoi(nArgsToKeep.c_str()));
 
  768      else if (
fImplNo > 0) 
return nullptr;
 
  769      else return selector;
 
 
  788   for(; it != 
it_end; ++it) {
 
 
  806       D->getPrimaryTemplate() != 
nullptr ||
 
  807       llvm::isa<clang::CXXMethodDecl>(D)) 
return nullptr;
 
 
  897#ifdef SELECTION_DEBUG 
  898      std::cout<<
"\n\tfYes = "<<fYes<<
", fImplNo = "<<
fImplNo<<std::endl;
 
  902      else if (
fImplNo > 0) 
return nullptr;
 
  903      else return selector;
 
 
  914       D->getPrimaryTemplate() != 
nullptr ||
 
  915       llvm::isa<clang::CXXMethodDecl>(D)) 
return nullptr;
 
  962      else if (
fImplNo > 0) 
return nullptr;
 
  963      else return selector;
 
 
  972   std::list<VariableSelectionRule>::const_iterator it;
 
  973   std::list<VariableSelectionRule>::const_iterator 
it_end;
 
  984   for(; it != 
it_end; ++it) {
 
  986         it->Match(llvm::dyn_cast<clang::NamedDecl>(D), 
qual_name, 
"", 
false);
 
 1017#ifdef SELECTION_DEBUG 
 1018      std::cout<<
"\n\tfYes = "<<fYes<<
", fImplNo = "<<
fImplNo<<std::endl;
 
 1022      else if (
fImplNo > 0) 
return nullptr;
 
 1023      else return selector;
 
 
 1049   if (
const clang::FunctionDecl* F = llvm::dyn_cast<clang::FunctionDecl> (D))
 
 1053#ifdef SELECTION_DEBUG 
 1054   std::cout<<
"\tFunction prototype = "<<
prototype<<std::endl;
 
 1062   if (D->getKind() == clang::Decl::CXXMethod){
 
 1065      for(; it != 
it_end; ++it) {
 
 1075#ifdef SELECTION_DEBUG 
 1076                  std::cout<<
"\tExplicit rule BaseSelectionRule::kNo found"<<std::endl;
 
 1084            if (it->GetAttributeValue(
"pattern", 
pat_value)) {
 
 1095#ifdef SELECTION_DEBUG 
 1096                     std::cout<<
"Implicit_rr rule ("<<
pat_value<<
"), selected = "<<
selected<<std::endl;
 
 1102#ifdef SELECTION_DEBUG 
 1103                     std::cout<<
"Implicit_rr rule ("<<
pat_value<<
"), selected = "<<
selected<<std::endl;
 
 1113#ifdef SELECTION_DEBUG 
 1114                     std::cout<<
"Implicit_r rule ("<<
pat_value<<
"), selected = "<<
selected<<std::endl;
 
 1120#ifdef SELECTION_DEBUG 
 1121                     std::cout<<
"Implicit_r rule ("<<
pat_value<<
"), selected = "<<
selected<<std::endl;
 
 1133#ifdef SELECTION_DEBUG 
 1134      std::cout<<
"\tExplicit rule BaseSelectionRule::BaseSelectionRule::kYes found"<<std::endl;
 
 1142#ifdef SELECTION_DEBUG 
 1143         std::cout<<
"\tImplicit_rr rule BaseSelectionRule::kNo found"<<std::endl;
 
 1150#ifdef SELECTION_DEBUG 
 1151         std::cout<<
"\tImplicit_rr rule BaseSelectionRule::kYes found"<<std::endl;
 
 1160#ifdef SELECTION_DEBUG 
 1161         std::cout<<
"\tImplicit_r rule BaseSelectionRule::kNo found"<<std::endl;
 
 1168#ifdef SELECTION_DEBUG 
 1169         std::cout<<
"\tImplicit_r rule BaseSelectionRule::kYes found"<<std::endl;
 
 1177#ifdef SELECTION_DEBUG 
 1178      std::cout<<
"\tChecking parent class rules"<<std::endl;
 
 1198            = it->Match(llvm::dyn_cast<clang::NamedDecl>(D), 
parent_qual_name, 
"", 
true); 
 
 1226#ifdef SELECTION_DEBUG 
 1227      std::cout<<
"\n\tfYes = "<<fYes<<
", fImplNo = "<<
fImplNo<<std::endl;
 
 1232#ifdef SELECTION_DEBUG 
 1233         std::cout<<
"\tReturning Yes"<<std::endl;
 
 1239#ifdef SELECTION_DEBUG 
 1240         std::cout<<
"\tReturning No"<<std::endl;
 
 1247#ifdef SELECTION_DEBUG 
 1248         std::cout<<
"\tReturning Yes"<<std::endl;
 
 
 1278            = it->Match(llvm::dyn_cast<clang::NamedDecl>(D), 
parent_qual_name, 
"", 
false);
 
 1297#ifdef SELECTION_DEBUG 
 1298                     std::cout<<
"\tNo returned"<<std::endl;
 
 1316               if (!it->HasMethodSelectionRules() && !it->HasFieldSelectionRules()) {
 
 1318#ifdef SELECTION_DEBUG 
 1319                  std::cout<<
"\tNo fields and methods"<<std::endl;
 
 1325                  clang::Decl::Kind kind = D->getKind();
 
 1326                  if (kind == clang::Decl::Field || kind == clang::Decl::CXXMethod || kind == clang::Decl::CXXConstructor || kind == clang::Decl::CXXDestructor){
 
 1327                     std::list<VariableSelectionRule> 
members;
 
 1328                     std::list<VariableSelectionRule>::iterator 
mem_it;
 
 1329                     std::list<VariableSelectionRule>::iterator 
mem_it_end;
 
 1332                     if (kind == clang::Decl::Field) {
 
 1333                        members = it->GetFieldSelectionRules();
 
 1336                        if (
const clang::FunctionDecl* F = llvm::dyn_cast<clang::FunctionDecl> (D)){
 
 1343                        members = it->GetMethodSelectionRules();
 
 1360#ifdef SELECTION_DEBUG 
 1361         std::cout<<
"\n\tfYes = "<<fYes<<
", fImplNo = "<<
fImplNo<<std::endl;
 
 1365#ifdef SELECTION_DEBUG 
 1366            std::cout<<
"\tReturning Yes"<<std::endl;
 
 1373#ifdef SELECTION_DEBUG 
 1374            std::cout<<
"\tReturning No"<<std::endl;
 
 1381#ifdef SELECTION_DEBUG 
 1382            std::cout<<
"\tReturning Yes"<<std::endl;
 
 
 1402         if (
rule.GetAttributeValue(
"pattern", 
name)) {
 
 1404         } 
else if (
rule.GetAttributeValue(
"name", 
name)) {
 
 1418         const char* 
attrVal = 
nullptr;
 
 1428         if (
rule.GetAttributeValue(
"pattern", 
name)) {
 
 1430         } 
else if (
rule.GetAttributeValue(
"name", 
name)) {
 
 1437            rule.PrintAttributes(std::cout,3);
 
 1442#if defined(R__MUST_REVISIT) 
 1443#if R__MUST_REVISIT(6,2) 
 1445"Warnings concerning non matching selection rules are suppressed. An action is to be taken.\n");
 
 1479#if Enums_rules_becomes_useful_for_rootcling 
 1483         if (
rule.GetAttributeValue(
"pattern", 
name)) {
 
 1485         } 
else if (
rule.GetAttributeValue(
"name", 
name)) {
 
 1494            rule.PrintAttributes(std::cout,3);
 
 
 1509      if (it->HasAttributeWithName(
"name")) {
 
 1513         const clang::Type *
typeptr = 
nullptr;
 
 1514         const clang::CXXRecordDecl *
target 
 
const clang::CXXRecordDecl * R__ScopeSearch(const char *name, const clang::Type **resultType=nullptr)
 
static bool Implies(const ClassSelectionRule &patternRule, const ClassSelectionRule &nameRule)
 
static bool HasDuplicate(RULE *rule, std::unordered_map< std::string, RULE * > &storedRules, const std::string &attrName)
 
static int CheckDuplicatesImp(RULESCOLLECTION &rules)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
 
const_iterator begin() const
 
const_iterator end() const
 
const BaseSelectionRule * IsLinkdefVarSelected(const clang::VarDecl *D, const std::string &qual_name) const
 
void GetDeclQualName(const clang::Decl *D, std::string &qual_name) const
 
const BaseSelectionRule * IsVarSelected(const clang::VarDecl *D, const std::string &qual_name) const
 
const BaseSelectionRule * IsFunSelected(const clang::FunctionDecl *D, const std::string &qual_name) const
 
void AddVariableSelectionRule(const VariableSelectionRule &varSel)
 
void AddClassSelectionRule(const ClassSelectionRule &classSel)
 
std::list< VariableSelectionRule > fVariableSelectionRules
List of the global variables selection rules.
 
bool AreAllSelectionRulesUsed() const
 
bool GetFunctionPrototype(const clang::FunctionDecl *F, std::string &prototype) const
 
bool SearchNames(cling::Interpreter &interp)
 
bool GetParentName(const clang::Decl *D, std::string &parent_name, std::string &parent_qual_name) const
 
std::list< FunctionSelectionRule > fFunctionSelectionRules
List of the global functions selection rules.
 
const BaseSelectionRule * IsLinkdefFunSelected(const clang::FunctionDecl *D, const std::string &qual_name) const
 
std::list< EnumSelectionRule > fEnumSelectionRules
List of the enums selection rules.
 
void PrintSelectionRules() const
 
bool GetHasFileNameRule() const
 
ROOT::TMetaUtils::TNormalizedCtxt & fNormCtxt
 
bool IsLinkdefFile() const
 
bool GetDeclName(const clang::Decl *D, std::string &name, std::string &qual_name) const
 
void AddEnumSelectionRule(const EnumSelectionRule &enumSel)
 
const BaseSelectionRule * IsMemberSelected(const clang::Decl *D, const std::string &str_name) const
 
bool IsSelectionXMLFile() const
 
void ClearSelectionRules()
 
bool IsParentClass(const clang::Decl *D) const
 
const BaseSelectionRule * IsLinkdefEnumSelected(const clang::EnumDecl *D, const std::string &qual_name) const
 
void AddFunctionSelectionRule(const FunctionSelectionRule &funcSel)
 
const BaseSelectionRule * IsEnumSelected(const clang::EnumDecl *D, const std::string &qual_name) const
 
const ClassSelectionRule * IsDeclSelected(const clang::RecordDecl *D, bool includeTypedefRule) const
 
const ClassSelectionRule * IsNamespaceSelected(const clang::Decl *D, const std::string &qual_name) const
 
std::list< ClassSelectionRule > fClassSelectionRules
List of the class selection rules.
 
cling::Interpreter & fInterp
 
const BaseSelectionRule * IsLinkdefMethodSelected(const clang::Decl *D, const std::string &qual_name) const
 
const ClassSelectionRule * IsClassSelected(const clang::Decl *D, const std::string &qual_name, bool includeTypedefRule) const
 
bool areEqual(const RULE *r1, const RULE *r2, bool moduloNameOrPattern=false)