<commit_before>//===- LexicalScopes.cpp - Collecting lexical scope info -*- C++ -*--------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements LexicalScopes analysis.
//
// This pass collects lexical scope information and maps machine instructions
// to respective lexical scopes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_LEXICALSCOPES_H
#define LLVM_CODEGEN_LEXICALSCOPES_H

#include "llvm/Metadata.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/ValueHandle.h"
#include <utility>
namespace llvm {

class MachineInstr;
class MachineBasicBlock;
class MachineFunction;
class LexicalScope;

//===----------------------------------------------------------------------===//
/// InsnRange - This is used to track range of instructions with identical
/// lexical scope.
///
typedef std::pair<const MachineInstr *, const MachineInstr *> InsnRange;

//===----------------------------------------------------------------------===//
/// LexicalScopes -  This class provides interface to collect and use lexical
/// scoping information from machine instruction.
///
class LexicalScopes {
public:
  LexicalScopes() : MF(NULL),  CurrentFnLexicalScope(NULL) { }
  ~LexicalScopes();

  /// initialize - Scan machine function and constuct lexical scope nest.
  virtual void initialize(const MachineFunction &);

  /// releaseMemory - release memory.
  virtual void releaseMemory();
  
  /// empty - Return true if there is any lexical scope information available.
  bool empty() { return CurrentFnLexicalScope == NULL; }

  /// isCurrentFunctionScope - Return true if given lexical scope represents 
  /// current function.
  bool isCurrentFunctionScope(const LexicalScope *LS) { 
    return LS == CurrentFnLexicalScope;
  }

  /// getCurrentFunctionScope - Return lexical scope for the current function.
  LexicalScope *getCurrentFunctionScope() const { return CurrentFnLexicalScope;}

  /// getMachineBasicBlocks - Populate given set using machine basic blocks
  /// which have machine instructions that belong to lexical scope identified by
  /// DebugLoc.
  void getMachineBasicBlocks(DebugLoc DL,
                             SmallPtrSet<const MachineBasicBlock*, 4> &MBBs);

  /// dominates - Return true if DebugLoc's lexical scope dominates at least one
  /// machine instruction's lexical scope in a given machine basic block.
  bool dominates(DebugLoc DL, MachineBasicBlock *MBB);
<commit_msg>A virtual destructor for the class with virtual methods!<commit_after>//===- LexicalScopes.cpp - Collecting lexical scope info -*- C++ -*--------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements LexicalScopes analysis.
//
// This pass collects lexical scope information and maps machine instructions
// to respective lexical scopes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_LEXICALSCOPES_H
#define LLVM_CODEGEN_LEXICALSCOPES_H

#include "llvm/Metadata.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/ValueHandle.h"
#include <utility>
namespace llvm {

class MachineInstr;
class MachineBasicBlock;
class MachineFunction;
class LexicalScope;

//===----------------------------------------------------------------------===//
/// InsnRange - This is used to track range of instructions with identical
/// lexical scope.
///
typedef std::pair<const MachineInstr *, const MachineInstr *> InsnRange;

//===----------------------------------------------------------------------===//
/// LexicalScopes -  This class provides interface to collect and use lexical
/// scoping information from machine instruction.
///
class LexicalScopes {
public:
  LexicalScopes() : MF(NULL),  CurrentFnLexicalScope(NULL) { }
  virtual ~LexicalScopes();

  /// initialize - Scan machine function and constuct lexical scope nest.
  virtual void initialize(const MachineFunction &);

  /// releaseMemory - release memory.
  virtual void releaseMemory();
  
  /// empty - Return true if there is any lexical scope information available.
  bool empty() { return CurrentFnLexicalScope == NULL; }

  /// isCurrentFunctionScope - Return true if given lexical scope represents 
  /// current function.
  bool isCurrentFunctionScope(const LexicalScope *LS) { 
    return LS == CurrentFnLexicalScope;
  }

  /// getCurrentFunctionScope - Return lexical scope for the current function.
  LexicalScope *getCurrentFunctionScope() const { return CurrentFnLexicalScope;}

  /// getMachineBasicBlocks - Populate given set using machine basic blocks
  /// which have machine instructions that belong to lexical scope identified by
  /// DebugLoc.
  void getMachineBasicBlocks(DebugLoc DL,
                             SmallPtrSet<const MachineBasicBlock*, 4> &MBBs);

  /// dominates - Return true if DebugLoc's lexical scope dominates at least one
  /// machine instruction's lexical scope in a given machine basic block.
  bool dominates(DebugLoc DL, MachineBasicBlock *MBB);

{'fraction_non_alphanumeric': 0.19879837427107264, 'fraction_numerical': 0.00035341933203746247, 'mean_word_length': 2.369047619047619, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2539230', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1379, 'n_words': 475}