<commit_before>#include "ExpertSystem/FunctionNamer.h"
#include <string>

FunctionNamer::FunctionNamer() {
   gensymID = 0L;
   registerID = 0L;
   basicBlockID = 0L;
   regionID = 0L;
   loopID = 0L;
   names = new llvm::DenseMap<PointerAddress, std::string>();
   instructionIndices = new std::map<std::string, PointerAddress>();
}
void FunctionNamer::setFunctionName(char* functionName) {
   //copy it to be on the safe side
   if(fnName) {
      free(fnName);
   }
   char* buf = (char*)calloc(strlen(functionName), sizeof(char));
   sprintf(buf, "%s", functionName);
   fnName = buf;
}
char* FunctionNamer::getFunctionName() {
   return fnName;
}
FunctionNamer::~FunctionNamer() { 
   delete instructionIndices; 
   delete names;
   delete fnName;
}

llvm::DenseMap<PointerAddress, std::string>& FunctionNamer::getTranslationTable() { 
   return *names; 
}
PointerAddress FunctionNamer::nextGensymID() { 
   return gensymID++; 
}
PointerAddress FunctionNamer::nextRegisterID() {
   return registerID++; 
}
PointerAddress FunctionNamer::nextBasicBlockID() { 
   return basicBlockID++; 
}
PointerAddress FunctionNamer::nextRegionID() { 
   return regionID++; 
}
PointerAddress FunctionNamer::nextLoopID() { 
   return loopID++; 
}
PointerAddress FunctionNamer::getRegisterIDCount() { 
   return registerID; 
}
PointerAddress FunctionNamer::getBasicBlockIDCount() {<commit_msg>Fixed a bug with FunctionNamer deallocating invalid pointers<commit_after>#include "ExpertSystem/FunctionNamer.h"
#include <string>

FunctionNamer::FunctionNamer() {
   gensymID = 0L;
   registerID = 0L;
   basicBlockID = 0L;
   regionID = 0L;
   loopID = 0L;
   names = new llvm::DenseMap<PointerAddress, std::string>();
   instructionIndices = new std::map<std::string, PointerAddress>();
   fnName = (char*)0;
}
void FunctionNamer::setFunctionName(char* functionName) {
   //copy it to be on the safe side
   if(fnName) {
      free(fnName);
   }
   char* buf = (char*)calloc(strlen(functionName) + 1, sizeof(char));
   sprintf(buf, "%s", functionName);
   fnName = buf;
}
char* FunctionNamer::getFunctionName() {
   return fnName;
}
FunctionNamer::~FunctionNamer() { 
   delete instructionIndices; 
   delete names;
   if(fnName) {
     free(fnName);
   }
}

llvm::DenseMap<PointerAddress, std::string>& FunctionNamer::getTranslationTable() { 
   return *names; 
}
PointerAddress FunctionNamer::nextGensymID() { 
   return gensymID++; 
}
PointerAddress FunctionNamer::nextRegisterID() {
   return registerID++; 
}
PointerAddress FunctionNamer::nextBasicBlockID() { 
   return basicBlockID++; 
}
PointerAddress FunctionNamer::nextRegionID() { 
   return regionID++; 
}
PointerAddress FunctionNamer::nextLoopID() { 
   return loopID++; 
}
PointerAddress FunctionNamer::getRegisterIDCount() { 
   return registerID; 
}
PointerAddress FunctionNamer::getBasicBlockIDCount() {
{'fraction_non_alphanumeric': 0.12968804766912023, 'fraction_numerical': 0.004206098843322818, 'mean_word_length': 5.150862068965517, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6593703', 'n_tokens_mistral': 933, 'n_tokens_neox': 914, 'n_words': 184}