cfgpass.cpp
No OneTemporary

File Metadata

Created
Tue, Jul 7, 7:40 PM

cfgpass.cpp

#include "cfgpass.h"
#include <QString>
using namespace std;
using namespace xreate;
void
CFGPass::start()
{
__context.graph = CFGraph();
}
void
CFGPass::finish()
{
man->clasp->addCFGData(move(__context.graph));
}
CFGPass::CFGPass(PassManager* manager)
: ASTPass(manager)
{
man->registerFilter(this, PassFilter:: FUNCTION);
man->registerFilter(this, PassFilter:: FUNCTIONCALL);
}
void
CFGPass::process(ManagedFnPtr function, PassContext context)
{
//FUNCTION decl
if (context.function == function)
{
const string& name = function->getName();
__context.graph.addNode(function.id(), string(name));
return;
}
//FUNCTIONCALL decl
__context.graph.addLink(context.function.id(), function.id());
}

Event Timeline