<commit_before>#ifndef DG_CDA_IGRAPHBUILDER_H_
#define DG_CDA_IGRAPHBUILDER_H_

#include <unordered_map>

#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"

#include "dg/llvm/PointerAnalysis/PointerAnalysis.h"
#include "dg/llvm/CallGraph/CallGraph.h"

#include "ControlDependence/CDGraph.h"
#include "GraphBuilder.h"
#include "dg/util/debug.h"

namespace dg {
namespace llvmdg {

namespace {
    const llvm::Instruction *
    getNextNonDebugInstruction(const llvm::Instruction *I) {
#if LLVM_VERSION_MAJOR >= 7
    return I->getNextNonDebugInstruction();
#else
    // this is the implementation of Instruction::getNextNonDebugInstruction()
    // from LLVM 12 (adjusted)
    for (const auto *I = getNextNode(); I; I = I->getNextNode())
      if (!llvm::isa<llvm::DbgInfoIntrinsic>(I))
        return I;
    return nullptr;
#endif
    }
}

///
// Whole-program graph for interprocedural analysis.
// Note that control dependencies include separate interprocedural analysis
// that fills in interprocedural CD into intraprocedural result.
// But this is another way how to do that.... (not used by default)
class ICDGraphBuilder {
    using CDGraph = dg::CDGraph;

    struct CallInfo {
        // called functions
        std::vector<const llvm::Function *> funs;<commit_msg>CDA: fix IGraphBuilder again<commit_after>#ifndef DG_CDA_IGRAPHBUILDER_H_
#define DG_CDA_IGRAPHBUILDER_H_

#include <unordered_map>

#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"

#include "dg/llvm/PointerAnalysis/PointerAnalysis.h"
#include "dg/llvm/CallGraph/CallGraph.h"

#include "ControlDependence/CDGraph.h"
#include "GraphBuilder.h"
#include "dg/util/debug.h"

namespace dg {
namespace llvmdg {

namespace {
    const llvm::Instruction *
    getNextNonDebugInstruction(const llvm::Instruction *I) {
#if LLVM_VERSION_MAJOR >= 7
    return I->getNextNonDebugInstruction();
#else
    // this is the implementation of Instruction::getNextNonDebugInstruction()
    // from LLVM 12 (adjusted)
    for (const auto *NI = I->getNextNode(); NI; NI = NI->getNextNode())
      if (!llvm::isa<llvm::DbgInfoIntrinsic>(NI))
        return NI;
    return nullptr;
#endif
    }
}

///
// Whole-program graph for interprocedural analysis.
// Note that control dependencies include separate interprocedural analysis
// that fills in interprocedural CD into intraprocedural result.
// But this is another way how to do that.... (not used by default)
class ICDGraphBuilder {
    using CDGraph = dg::CDGraph;

    struct CallInfo {
        // called functions
        std::vector<const llvm::Function *> funs;
{'fraction_non_alphanumeric': 0.11312741312741313, 'fraction_numerical': 0.0023166023166023165, 'mean_word_length': 4.090373280943026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, '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': '812717', 'n_tokens_mistral': 856, 'n_tokens_neox': 834, 'n_words': 216}