<commit_before>//===-- ModuleProvider.cpp - Base implementation for module providers -----===//
//
// Minimal implementation of the abstract interface for providing a module.
//
//===----------------------------------------------------------------------===//

#include "llvm/ModuleProvider.h"
#include "llvm/Module.h"

/// ctor - always have a valid Module
///
ModuleProvider::ModuleProvider() : TheModule(0) { }

/// dtor - when we leave, we take our Module with us
///
ModuleProvider::~ModuleProvider() {
  delete TheModule;
}

/// materializeFunction - make sure the given function is fully read.
///
Module* ModuleProvider::materializeModule() {
  // FIXME: throw an exception instead?
  if (!TheModule) return 0;

  for (Module::iterator i = TheModule->begin(), e = TheModule->end();
       i != e; ++i)
    materializeFunction(i);

  return TheModule;
}<commit_msg>Chris says it's better to assert that TheModule is valid than silently return 0.<commit_after>//===-- ModuleProvider.cpp - Base implementation for module providers -----===//
//
// Minimal implementation of the abstract interface for providing a module.
//
//===----------------------------------------------------------------------===//

#include "llvm/ModuleProvider.h"
#include "llvm/Module.h"

/// ctor - always have a valid Module
///
ModuleProvider::ModuleProvider() : TheModule(0) { }

/// dtor - when we leave, we take our Module with us
///
ModuleProvider::~ModuleProvider() {
  delete TheModule;
}

/// materializeFunction - make sure the given function is fully read.
///
Module* ModuleProvider::materializeModule() {
  assert(TheModule && "Attempting to materialize an invalid module!");

  for (Module::iterator i = TheModule->begin(), e = TheModule->end();
       i != e; ++i)
    materializeFunction(i);

  return TheModule;
}
{'fraction_non_alphanumeric': 0.22075055187637968, 'fraction_numerical': 0.002207505518763797, 'mean_word_length': 2.56188605108055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5753781', 'n_tokens_mistral': 476, 'n_tokens_neox': 468, 'n_words': 159}