<commit_before>// @(#)root/utils/src:$Id$
// Author: <NAME> 2011 ; originated from <NAME>   16/04/2010 and <NAME>.


/*************************************************************************
 * Copyright (C) 1995-2011, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/rootcint.            *
 *************************************************************************/

#ifndef ROOT__RSCANNER_H__
#define ROOT__RSCANNER_H__

#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/Type.h"
#include "clang/AST/RecursiveASTVisitor.h"

#include "llvm/Module.h"

#include "XMLReader.h"
#include "LinkdefReader.h"
#include <stack>

namespace clang {
   class RecordDecl;
}

class SelectionRules;

/* -------------------------------------------------------------------------- */

// Note form Velislava: We are inheriting here from the class RecursiveASTVisitor
// which traverses every node of the AST
class RScanner: public clang::RecursiveASTVisitor<RScanner>
{
private:
   const SelectionRules &fSelectionRules;
   const clang::SourceManager* fSourceManager;
   unsigned int fVerboseLevel;

private:
   static int fgAnonymousClassCounter;
   static int fgBadClassCounter;
   static int fgAnonymousEnumCounter;

   static std::map <clang::Decl*, std::string> fgAnonymousClassMap;
   static std::map <clang::Decl*, std::string> fgAnonymousEnumMap;

private:
   // only for debugging

   static const int fgDeclLast = clang::Decl::Var;
   bool fDeclTable [ fgDeclLast+1 ];

   static const int fgTypeLast = clang::Type::TemplateTypeParm;
   bool fTypeTable [ fgTypeLast+1 ];

   clang::Decl * fLastDecl;

public:
   static const char* fgClangDeclKey; // property key used for CLang declaration objects
   static const char* fgClangFuncKey; // property key for function (demangled) names

   class AnnotatedRecordDecl {
   private:
      long fRuleIndex;
      const clang::RecordDecl* fDecl;
      std::string fRequestedName;
      bool fRequestStreamerInfo;
      bool fRequestNoStreamer;
      bool fRequestNoInputOperator;
      bool fRequestOnlyTClass;
      int  fRequestedVersionNumber;
      
   public:
      enum {
         kNoStreamer      = 0x01,
         kNoInputOperator = 0x02,
         kUseByteCount    = 0x04,
         kStreamerInfo    = 0x04,
         kHasVersion      = 0x08
      } ERootFlag;

      AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber) : 
            fRuleIndex(index), fDecl(decl), fRequestStreamerInfo(rStreamerInfo), fRequestNoStreamer(rNoStreamer),
            fRequestNoInputOperator(rRequestNoInputOperator), fRequestOnlyTClass(rRequestOnlyTClass), fRequestedVersionNumber(rRequestedVersionNumber) 
            {}
      AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, const char *requestName, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber);
     ~AnnotatedRecordDecl() {
         // Nothing to do we do not own the pointer;
      }
      const char *GetRequestedName() const { return fRequestedName.c_str(); }
      bool HasClassVersion() const { return fRequestedVersionNumber >=0 ; }
      bool RequestStreamerInfo() const { 
         // Equivalent to CINT's cl.RootFlag() & G__USEBYTECOUNT 
         return fRequestStreamerInfo; 
      }
      bool RequestNoInputOperator() const { return fRequestNoInputOperator; }
      bool RequestNoStreamer() const { return fRequestNoStreamer; }
      bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
      int  RequestedVersionNumber() const { return fRequestedVersionNumber; }
      int  RootFlag() const;
      const clang::RecordDecl* GetRecordDecl() const { return fDecl; }<commit_msg>Fix enum declaration<commit_after>// @(#)root/utils/src:$Id$
// Author: <NAME> 2011 ; originated from <NAME>   16/04/2010 and <NAME>.


/*************************************************************************
 * Copyright (C) 1995-2011, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/rootcint.            *
 *************************************************************************/

#ifndef ROOT__RSCANNER_H__
#define ROOT__RSCANNER_H__

#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/Type.h"
#include "clang/AST/RecursiveASTVisitor.h"

#include "llvm/Module.h"

#include "XMLReader.h"
#include "LinkdefReader.h"
#include <stack>

namespace clang {
   class RecordDecl;
}

class SelectionRules;

/* -------------------------------------------------------------------------- */

// Note form Velislava: We are inheriting here from the class RecursiveASTVisitor
// which traverses every node of the AST
class RScanner: public clang::RecursiveASTVisitor<RScanner>
{
private:
   const SelectionRules &fSelectionRules;
   const clang::SourceManager* fSourceManager;
   unsigned int fVerboseLevel;

private:
   static int fgAnonymousClassCounter;
   static int fgBadClassCounter;
   static int fgAnonymousEnumCounter;

   static std::map <clang::Decl*, std::string> fgAnonymousClassMap;
   static std::map <clang::Decl*, std::string> fgAnonymousEnumMap;

private:
   // only for debugging

   static const int fgDeclLast = clang::Decl::Var;
   bool fDeclTable [ fgDeclLast+1 ];

   static const int fgTypeLast = clang::Type::TemplateTypeParm;
   bool fTypeTable [ fgTypeLast+1 ];

   clang::Decl * fLastDecl;

public:
   static const char* fgClangDeclKey; // property key used for CLang declaration objects
   static const char* fgClangFuncKey; // property key for function (demangled) names

   class AnnotatedRecordDecl {
   private:
      long fRuleIndex;
      const clang::RecordDecl* fDecl;
      std::string fRequestedName;
      bool fRequestStreamerInfo;
      bool fRequestNoStreamer;
      bool fRequestNoInputOperator;
      bool fRequestOnlyTClass;
      int  fRequestedVersionNumber;
      
   public:
      enum ERootFlag {
         kNoStreamer      = 0x01,
         kNoInputOperator = 0x02,
         kUseByteCount    = 0x04,
         kStreamerInfo    = 0x04,
         kHasVersion      = 0x08
      };

      AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber) : 
            fRuleIndex(index), fDecl(decl), fRequestStreamerInfo(rStreamerInfo), fRequestNoStreamer(rNoStreamer),
            fRequestNoInputOperator(rRequestNoInputOperator), fRequestOnlyTClass(rRequestOnlyTClass), fRequestedVersionNumber(rRequestedVersionNumber) 
            {}
      AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, const char *requestName, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber);
     ~AnnotatedRecordDecl() {
         // Nothing to do we do not own the pointer;
      }
      const char *GetRequestedName() const { return fRequestedName.c_str(); }
      bool HasClassVersion() const { return fRequestedVersionNumber >=0 ; }
      bool RequestStreamerInfo() const { 
         // Equivalent to CINT's cl.RootFlag() & G__USEBYTECOUNT 
         return fRequestStreamerInfo; 
      }
      bool RequestNoInputOperator() const { return fRequestNoInputOperator; }
      bool RequestNoStreamer() const { return fRequestNoStreamer; }
      bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
      int  RequestedVersionNumber() const { return fRequestedVersionNumber; }
      int  RootFlag() const;
      const clang::RecordDecl* GetRecordDecl() const { return fDecl; }
{'fraction_non_alphanumeric': 0.13556062973200336, 'fraction_numerical': 0.009133517606056964, 'mean_word_length': 3.0496350364963503, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2938682', 'n_tokens_mistral': 2432, 'n_tokens_neox': 2323, 'n_words': 588}