<commit_before>//===-- TypeSystem.h ------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_TypeSystem_h_
#define liblldb_TypeSystem_h_

// C Includes
// C++ Includes
#include <functional>
#include <map>
#include <mutex>
#include <string>

// Other libraries and framework includes
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/Casting.h"

// Project includes
#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
#include "lldb/lldb-private.h"

class DWARFDIE;
class DWARFASTParser;

namespace lldb_private {

//----------------------------------------------------------------------
// Interface for representing the Type Systems in different languages.
//----------------------------------------------------------------------
class TypeSystem : public PluginInterface {
public:
  //----------------------------------------------------------------------
  // Intrusive type system that allows us to use llvm casting.
  //
  // To add a new type system:
  //
  // 1 - Add a new enumeration for llvm casting below for your TypeSystem
  //     subclass, here we will use eKindFoo
  //
  // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs
  //     to implement a static classof() function that returns your
  //     enumeration:
  //
  //    class Foo : public lldb_private::TypeSystem
  //    {
  //        static bool classof(const TypeSystem *ts)
  //        {
  //            return ts->getKind() == TypeSystem::eKindFoo;
  //        }
  //    };
  //
  // 3 - Contruct your TypeSystem subclass with the enumeration from below
  //
  //    Foo() :
  //        TypeSystem(TypeSystem::eKindFoo),
  //        ...
  //    {
  //    }
  //
  // Then you can use the llvm casting on any "TypeSystem *" to get an
  // instance of your subclass.
  //----------------------------------------------------------------------
  enum LLVMCastKind {
    eKindClang,
    eKindSwift,
    eKindGo,
    eKindJava,
    eKindOCaml,
    kNumKinds
  };

  //----------------------------------------------------------------------
  // Constructors and Destructors
  //----------------------------------------------------------------------
  TypeSystem(LLVMCastKind kind);

  ~TypeSystem() override;

  LLVMCastKind getKind() const { return m_kind; }

  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                           Module *module);

  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                           Target *target,
                                           const char *compiler_options);

  // Free up any resources associated with this TypeSystem.  Done before<commit_msg>Need the changed .h file for the previous commit to build.<commit_after>//===-- TypeSystem.h ------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_TypeSystem_h_
#define liblldb_TypeSystem_h_

// C Includes
// C++ Includes
#include <functional>
#include <map>
#include <mutex>
#include <string>

// Other libraries and framework includes
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/Casting.h"

// Project includes
#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
#include "lldb/lldb-private.h"

class DWARFDIE;
class DWARFASTParser;

namespace lldb_private {

//----------------------------------------------------------------------
// Interface for representing the Type Systems in different languages.
//----------------------------------------------------------------------
class TypeSystem : public PluginInterface {
public:
  //----------------------------------------------------------------------
  // Intrusive type system that allows us to use llvm casting.
  //
  // To add a new type system:
  //
  // 1 - Add a new enumeration for llvm casting below for your TypeSystem
  //     subclass, here we will use eKindFoo
  //
  // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs
  //     to implement a static classof() function that returns your
  //     enumeration:
  //
  //    class Foo : public lldb_private::TypeSystem
  //    {
  //        static bool classof(const TypeSystem *ts)
  //        {
  //            return ts->getKind() == TypeSystem::eKindFoo;
  //        }
  //    };
  //
  // 3 - Contruct your TypeSystem subclass with the enumeration from below
  //
  //    Foo() :
  //        TypeSystem(TypeSystem::eKindFoo),
  //        ...
  //    {
  //    }
  //
  // Then you can use the llvm casting on any "TypeSystem *" to get an
  // instance of your subclass.
  //----------------------------------------------------------------------
  enum LLVMCastKind {
    eKindClang,
    eKindSwift,
    eKindGo,
    eKindJava,
    eKindOCaml,
    kNumKinds
  };

  //----------------------------------------------------------------------
  // Constructors and Destructors
  //----------------------------------------------------------------------
  TypeSystem(LLVMCastKind kind);

  ~TypeSystem() override;

  LLVMCastKind getKind() const { return m_kind; }

  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                           Module *module);

  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                           Target *target,
                                           const char *compiler_options);

  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                           Target *target);

  // Free up any resources associated with this TypeSystem.  Done before
{'fraction_non_alphanumeric': 0.2605455122105931, 'fraction_numerical': 0.0009514747859181732, 'mean_word_length': 1.3402597402597403, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4989325', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1551, 'n_words': 455}