<commit_before>//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id: 2e7bf01c5cf0048b0e6353b5ba55d09cc0961993 $
// author:  <NAME> <<EMAIL>>
//------------------------------------------------------------------------------

#ifndef CLING_INCREMENTAL_PARSER_H
#define CLING_INCREMENTAL_PARSER_H

#include "clang/Basic/SourceLocation.h"

#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"

#include <vector>
#include <deque>

namespace llvm {
  struct GenericValue;
  class MemoryBuffer;
}

namespace clang {
  class CodeGenerator;
  class CompilerInstance;
  class FileID;
  class Parser;
}


namespace cling {
  class CompilationOptions;
  class CIFactory;
  class DeclCollector;
  class ExecutionContext;
  class Interpreter;
  class Transaction;
  class TransactionPool;
  class TransactionTransformer;

  ///\brief Responsible for the incremental parsing and compilation of input.
  ///
  /// The class manages the entire process of compilation line-by-line by 
  /// appending the compiled delta to clang'a AST. It provides basic operations
  /// on the already compiled code. See cling::Transaction class.
  ///
  class IncrementalParser {
  private:
    // our interpreter context
    // FIXME: Get rid of that back reference to the interpreter.
    Interpreter* m_Interpreter;

    // compiler instance.
    llvm::OwningPtr<clang::CompilerInstance> m_CI;

    // parser (incremental)
    llvm::OwningPtr<clang::Parser> m_Parser;

    // One buffer for each command line, owner by the source file manager
    std::vector<llvm::MemoryBuffer*> m_MemoryBuffers;

    // file ID of the memory buffer
    clang::FileID m_VirtualFileID;

    // CI owns it
    DeclCollector* m_Consumer;

    ///\brief The storage for our transactions.
    ///
    /// We don't need the elements to be contiguous in memory, that is why we
    /// don't use std::vector. We don't need to copy the elements every time the
    /// capacity is exceeded.
    ///
    std::deque<Transaction*> m_Transactions;

    ///\brief Code generator
    ///
    llvm::OwningPtr<clang::CodeGenerator> m_CodeGen;

    ///\brief Contains the transaction AST transformers.
    ///
    llvm::SmallVector<TransactionTransformer*, 6> m_ASTTransformers;

    ///\brief Contains the transaction IR transformers.
    ///
    llvm::SmallVector<TransactionTransformer*, 2> m_IRTransformers;<commit_msg>Use deque: we do not require the MemoryBuffers do be consecutive.<commit_after>//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id: 2e7bf01c5cf0048b0e6353b5ba55d09cc0961993 $
// author:  <NAME> <<EMAIL>>
//------------------------------------------------------------------------------

#ifndef CLING_INCREMENTAL_PARSER_H
#define CLING_INCREMENTAL_PARSER_H

#include "clang/Basic/SourceLocation.h"

#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"

#include <vector>
#include <deque>

namespace llvm {
  struct GenericValue;
  class MemoryBuffer;
}

namespace clang {
  class CodeGenerator;
  class CompilerInstance;
  class FileID;
  class Parser;
}


namespace cling {
  class CompilationOptions;
  class CIFactory;
  class DeclCollector;
  class ExecutionContext;
  class Interpreter;
  class Transaction;
  class TransactionPool;
  class TransactionTransformer;

  ///\brief Responsible for the incremental parsing and compilation of input.
  ///
  /// The class manages the entire process of compilation line-by-line by 
  /// appending the compiled delta to clang'a AST. It provides basic operations
  /// on the already compiled code. See cling::Transaction class.
  ///
  class IncrementalParser {
  private:
    // our interpreter context
    // FIXME: Get rid of that back reference to the interpreter.
    Interpreter* m_Interpreter;

    // compiler instance.
    llvm::OwningPtr<clang::CompilerInstance> m_CI;

    // parser (incremental)
    llvm::OwningPtr<clang::Parser> m_Parser;

    // One buffer for each command line, owner by the source file manager
    std::deque<llvm::MemoryBuffer*> m_MemoryBuffers;

    // file ID of the memory buffer
    clang::FileID m_VirtualFileID;

    // CI owns it
    DeclCollector* m_Consumer;

    ///\brief The storage for our transactions.
    ///
    /// We don't need the elements to be contiguous in memory, that is why we
    /// don't use std::vector. We don't need to copy the elements every time the
    /// capacity is exceeded.
    ///
    std::deque<Transaction*> m_Transactions;

    ///\brief Code generator
    ///
    llvm::OwningPtr<clang::CodeGenerator> m_CodeGen;

    ///\brief Contains the transaction AST transformers.
    ///
    llvm::SmallVector<TransactionTransformer*, 6> m_ASTTransformers;

    ///\brief Contains the transaction IR transformers.
    ///
    llvm::SmallVector<TransactionTransformer*, 2> m_IRTransformers;
{'fraction_non_alphanumeric': 0.1557100297914598, 'fraction_numerical': 0.01112214498510427, 'mean_word_length': 2.628242074927954, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2997165', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1434, 'n_words': 441}