<commit_before>//===-- InstrTypes.cpp - Implement Instruction subclasses --------*- C++ -*--=//
//
// This file implements 
//
//===----------------------------------------------------------------------===//

#include "llvm/iOther.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/SymbolTable.h"
#include "llvm/Type.h"
#include <algorithm>

//===----------------------------------------------------------------------===//
//                            TerminatorInst Class
//===----------------------------------------------------------------------===//

TerminatorInst::TerminatorInst(unsigned iType) 
  : Instruction(Type::VoidTy, iType, "") {
}


//===----------------------------------------------------------------------===//
//                            MethodArgument Class
//===----------------------------------------------------------------------===//

// Specialize setName to take care of symbol table majik
void MethodArgument::setName(const string &name) {
  Method *P;
  if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this);
  Value::setName(name);
  if (P && hasName()) P->getSymbolTable()->insert(this);
}


//===----------------------------------------------------------------------===//
//                               PHINode Class
//===----------------------------------------------------------------------===//

PHINode::PHINode(const Type *Ty, const string &name) 
  : Instruction(Ty, Instruction::PHINode, name) {
}

PHINode::PHINode(const PHINode &PN) 
  : Instruction(PN.getType(), Instruction::PHINode) {
  
  for (unsigned i = 0; i < PN.IncomingValues.size(); i++)
    IncomingValues.push_back(Use(PN.IncomingValues[i], this));
}

void PHINode::dropAllReferences() {
  IncomingValues.clear();
}

bool PHINode::setOperand(unsigned i, Value *Val) {
  assert(Val && "PHI node must only reference nonnull definitions!");
  if (i >= IncomingValues.size()) return false;

  IncomingValues[i] = Val;
  return true;
}

void PHINode::addIncoming(Value *D) {
  IncomingValues.push_back(Use(D, this));
}
<commit_msg>Add extra method to PHI node class<commit_after>//===-- InstrTypes.cpp - Implement Instruction subclasses --------*- C++ -*--=//
//
// This file implements 
//
//===----------------------------------------------------------------------===//

#include "llvm/iOther.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/SymbolTable.h"
#include "llvm/Type.h"
#include <algorithm>

//===----------------------------------------------------------------------===//
//                            TerminatorInst Class
//===----------------------------------------------------------------------===//

TerminatorInst::TerminatorInst(unsigned iType) 
  : Instruction(Type::VoidTy, iType, "") {
}


//===----------------------------------------------------------------------===//
//                            MethodArgument Class
//===----------------------------------------------------------------------===//

// Specialize setName to take care of symbol table majik
void MethodArgument::setName(const string &name) {
  Method *P;
  if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this);
  Value::setName(name);
  if (P && hasName()) P->getSymbolTable()->insert(this);
}


//===----------------------------------------------------------------------===//
//                               PHINode Class
//===----------------------------------------------------------------------===//

PHINode::PHINode(const Type *Ty, const string &name) 
  : Instruction(Ty, Instruction::PHINode, name) {
}

PHINode::PHINode(const PHINode &PN) 
  : Instruction(PN.getType(), Instruction::PHINode) {
  
  for (unsigned i = 0; i < PN.IncomingValues.size(); i++)
    IncomingValues.push_back(Use(PN.IncomingValues[i], this));
}

void PHINode::dropAllReferences() {
  IncomingValues.clear();
}

bool PHINode::setOperand(unsigned i, Value *Val) {
  assert(Val && "PHI node must only reference nonnull definitions!");
  if (i >= IncomingValues.size()) return false;

  IncomingValues[i] = Val;
  return true;
}

void PHINode::addIncoming(Value *D) {
  IncomingValues.push_back(Use(D, this));
}

// removeIncomingValue - Remove an incoming value.  This is useful if a
// predecessor basic block is deleted.
Value *PHINode::removeIncomingValue(unsigned idx) {
  Value *Removed = IncomingValues[idx];
  IncomingValues.erase(IncomingValues.begin()+idx);
  return Removed;
}
{'fraction_non_alphanumeric': 0.36813681368136814, 'fraction_numerical': 0.00045004500450045, 'mean_word_length': 1.4985947161326587, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '4088753', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1154, 'n_words': 248}