<commit_before>#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/AST/AST.h"
#include "clang/AST/Type.h"
#include "clang/Frontend/CompilerInstance.h"
#include "llvm/Support/raw_ostream.h"
#include "NodeTyper.h"
#include "TyperVisitor.h"
#include "llvm/Support/Debug.h"
#include "enerc.h"
#include <iostream>
#include <string>
#include <set>

using namespace clang;

namespace {

// The types in the EnerC type system.
const uint32_t ecPrecise = 0;
const uint32_t ecApprox = 1;

// Whitelist for standard-library functions with polymorphic types.
// C++11 TODO: Extended initializer lists would be nice here.
char const* polymorphicWhitelist_array[] = {
  "abs",
  "cos",
  "log",
  "exp",
  "pow",
  "sqrt",
  "sqrtf",
};
const std::set<std::string> polymorphicWhitelist(
  polymorphicWhitelist_array,
  polymorphicWhitelist_array +
    sizeof(polymorphicWhitelist_array) /
    sizeof(polymorphicWhitelist_array[0])
);

// The typer: assign types to AST nodes.
class EnerCTyper : public NodeTyper {<commit_msg>Fix #45: add functions to polymorphism whitelist<commit_after>#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/AST/AST.h"
#include "clang/AST/Type.h"
#include "clang/Frontend/CompilerInstance.h"
#include "llvm/Support/raw_ostream.h"
#include "NodeTyper.h"
#include "TyperVisitor.h"
#include "llvm/Support/Debug.h"
#include "enerc.h"
#include <iostream>
#include <string>
#include <set>

using namespace clang;

namespace {

// The types in the EnerC type system.
const uint32_t ecPrecise = 0;
const uint32_t ecApprox = 1;

// Whitelist for standard-library functions with polymorphic types.
// C++11 TODO: Extended initializer lists would be nice here.
char const* polymorphicWhitelist_array[] = {
  "abs",
  "cos",
  "log",
  "exp",
  "pow",
  "sqrt",
  "sqrtf",
  "sin",
  "tan",
  "acos",
  "asin",
  "atan",
  "atan2",
  "cosh",
  "sinh",
  "tanh",
  "log10",
  "ceil",
  "fabs",
  "floor",
  "fmod",
};
const std::set<std::string> polymorphicWhitelist(
  polymorphicWhitelist_array,
  polymorphicWhitelist_array +
    sizeof(polymorphicWhitelist_array) /
    sizeof(polymorphicWhitelist_array[0])
);

// The typer: assign types to AST nodes.
class EnerCTyper : public NodeTyper {
{'fraction_non_alphanumeric': 0.13734290843806105, 'fraction_numerical': 0.010323159784560144, 'mean_word_length': 4.819843342036553, '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': '5601834', 'n_tokens_mistral': 863, 'n_tokens_neox': 798, 'n_words': 194}