<commit_before>// @(#)root/core/meta:$Id$
// Author: <NAME>   30/07/2012

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

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TClingClassInfo                                                      //
//                                                                      //
// Emulation of the CINT ClassInfo class.                               //
//                                                                      //
// The CINT C++ interpreter provides an interface to metadata about     //
// a class through the ClassInfo class.  This class provides the same   //
// functionality, using an interface as close as possible to ClassInfo  //
// but the class metadata comes from the Clang C++ compiler, not CINT.  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TClingClassInfo.h"

#include "TClassEdit.h"
#include "TClingMethodInfo.h"
#include "Property.h"
#include "TClingProperty.h"
#include "TClingTypeInfo.h"
#include "TError.h"
#include "TMetaUtils.h"

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/LookupHelper.h"
#include "cling/Interpreter/StoredValueRef.h"

#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Type.h"
#include "clang/Frontend/CompilerInstance.h"
 
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"

#include <sstream>
#include <string>

using namespace clang;

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0)
{
   clang::TranslationUnitDecl *TU =
      interp->getCI()->getASTContext().getTranslationUnitDecl();
   fIter = TU->decls_begin();
   InternalNext();
   fFirstTime = true;
   fDecl = 0;
}

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp, const char *name)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0), fTitle("")
{
   if (gDebug > 0) {
      Info("TClingClassInfo(name)", "looking up class name: %s\n", name);
   }
   const cling::LookupHelper& lh = fInterp->getLookupHelper();
   const clang::Decl *decl = lh.findScope(name);
   if (!decl) {
      if (gDebug > 0) {
         Info("TClingClassInfo(name)", "cling class not found name: %s\n",
              name);
      }
      std::string buf = TClassEdit::InsertStd(name);
      decl = lh.findScope(buf);
      if (!decl) {
         if (gDebug > 0) {
            Info("TClingClassInfo(name)", "cling class not found name: %s\n",
                 buf.c_str());
         }
      }
      else {
         if (gDebug > 0) {
            Info("TClingClassInfo(name)", "found cling class name: %s  "
                 "decl: 0x%lx\n", buf.c_str(), (long) decl);
         }
      }
   }
   else {
      if (gDebug > 0) {
         Info("TClingClassInfo(name)", "found cling class name: %s  "
              "decl: 0x%lx\n", name, (long) decl);
      }
   }
   if (decl) {
      // Position our iterator on the found decl.
      /*AdvanceToDecl(decl);*/
      fFirstTime = false;
      //fDescend = false;
      fIter = clang::DeclContext::decl_iterator();
      //fTemplateDecl = 0;
      //fSpecIter = clang::ClassTemplateDecl::spec_iterator(0);
      fDecl = const_cast<clang::Decl*>(decl);
      //fIterStack.clear();
   }
}

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp,
                                 const clang::Decl *decl)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0), fTitle("")
{
   if (decl) {
      // Position our iterator on the given decl.
      AdvanceToDecl(decl);
      //fFirstTime = true;
      //fDescend = false;
      //fIter = clang::DeclContext::decl_iterator();
      //fTemplateDecl = 0;
      //fSpecIter = clang::ClassTemplateDecl::spec_iterator(0);
      //fDecl = const_cast<clang::Decl*>(decl);
      //fIterStack.clear();
   }
   else {
      // FIXME: Maybe initialize iterator to global namespace?
      fDecl = 0;
   }<commit_msg>Revert unintentional change of r46334<commit_after>// @(#)root/core/meta:$Id$
// Author: <NAME>   30/07/2012

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

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TClingClassInfo                                                      //
//                                                                      //
// Emulation of the CINT ClassInfo class.                               //
//                                                                      //
// The CINT C++ interpreter provides an interface to metadata about     //
// a class through the ClassInfo class.  This class provides the same   //
// functionality, using an interface as close as possible to ClassInfo  //
// but the class metadata comes from the Clang C++ compiler, not CINT.  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TClingClassInfo.h"

#include "TClassEdit.h"
#include "TClingMethodInfo.h"
#include "Property.h"
#include "TClingProperty.h"
#include "TClingTypeInfo.h"
#include "TError.h"
#include "TMetaUtils.h"

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/LookupHelper.h"
#include "cling/Interpreter/StoredValueRef.h"

#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Type.h"
#include "clang/Frontend/CompilerInstance.h"
 
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"

#include <sstream>
#include <string>

using namespace clang;

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0)
{
   clang::TranslationUnitDecl *TU =
      interp->getCI()->getASTContext().getTranslationUnitDecl();
   fIter = TU->decls_begin();
   InternalNext();
   fFirstTime = true;
   fDecl = 0;
}

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp, const char *name)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0), fTitle("")
{
   if (gDebug > 0) {
      Info("TClingClassInfo(name)", "looking up class name: %s\n", name);
   }
   const cling::LookupHelper& lh = fInterp->getLookupHelper();
   const clang::Decl *decl = lh.findScope(name);
   if (!decl) {
      if (gDebug > 0) {
         Info("TClingClassInfo(name)", "cling class not found name: %s\n",
              name);
      }
      std::string buf = TClassEdit::InsertStd(name);
      decl = lh.findScope(buf);
      if (!decl) {
         if (gDebug > 0) {
            Info("TClingClassInfo(name)", "cling class not found name: %s\n",
                 buf.c_str());
         }
      }
      else {
         if (gDebug > 0) {
            Info("TClingClassInfo(name)", "found cling class name: %s  "
                 "decl: 0x%lx\n", buf.c_str(), (long) decl);
         }
      }
   }
   else {
      if (gDebug > 0) {
         Info("TClingClassInfo(name)", "found cling class name: %s  "
              "decl: 0x%lx\n", name, (long) decl);
      }
   }
   if (decl) {
      // Position our iterator on the found decl.
      AdvanceToDecl(decl);
      //fFirstTime = false;
      //fDescend = false;
      //fIter = clang::DeclContext::decl_iterator();
      //fTemplateDecl = 0;
      //fSpecIter = clang::ClassTemplateDecl::spec_iterator(0);
      //fDecl = const_cast<clang::Decl*>(decl);
      //fIterStack.clear();
   }
}

TClingClassInfo::TClingClassInfo(cling::Interpreter *interp,
                                 const clang::Decl *decl)
   : fInterp(interp), fFirstTime(true), fDescend(false), fDecl(0), fTitle("")
{
   if (decl) {
      // Position our iterator on the given decl.
      AdvanceToDecl(decl);
      //fFirstTime = true;
      //fDescend = false;
      //fIter = clang::DeclContext::decl_iterator();
      //fTemplateDecl = 0;
      //fSpecIter = clang::ClassTemplateDecl::spec_iterator(0);
      //fDecl = const_cast<clang::Decl*>(decl);
      //fIterStack.clear();
   }
   else {
      // FIXME: Maybe initialize iterator to global namespace?
      fDecl = 0;
   }
{'fraction_non_alphanumeric': 0.1888097233864208, 'fraction_numerical': 0.0072296730930427495, 'mean_word_length': 1.8181281369943902, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '343550', 'n_tokens_mistral': 2821, 'n_tokens_neox': 2695, 'n_words': 598}