souffle  2.0.2-371-g6315b36
Public Member Functions | Private Member Functions | Private Attributes
souffle::ast::transform::DebugReporter Class Reference

Transformation pass which wraps another transformation pass and generates a debug report section for the stage after applying the wrapped transformer, and adds it to the translation unit's debug report. More...

#include <DebugReporter.h>

Inheritance diagram for souffle::ast::transform::DebugReporter:
Inheritance graph
Collaboration diagram for souffle::ast::transform::DebugReporter:
Collaboration graph

Public Member Functions

DebugReporterclone () const override
 
 DebugReporter (Own< Transformer > wrappedTransformer)
 
void disableTransformers (const std::set< std::string > &transforms) override
 
std::string getName () const override
 
std::vector< Transformer * > getSubtransformers () const override
 
void setDebugReport () override
 
void setVerbosity (bool verbose) override
 
- Public Member Functions inherited from souffle::ast::transform::MetaTransformer
bool applySubtransformer (TranslationUnit &translationUnit, Transformer *transformer)
 
- Public Member Functions inherited from souffle::ast::transform::Transformer
bool apply (TranslationUnit &translationUnit)
 
virtual ~Transformer ()=default
 

Private Member Functions

void generateDebugReport (TranslationUnit &tu, const std::string &preTransformDatalog)
 
bool transform (TranslationUnit &translationUnit) override
 

Private Attributes

Own< TransformerwrappedTransformer
 

Additional Inherited Members

- Protected Attributes inherited from souffle::ast::transform::MetaTransformer
bool verbose = false
 

Detailed Description

Transformation pass which wraps another transformation pass and generates a debug report section for the stage after applying the wrapped transformer, and adds it to the translation unit's debug report.

Definition at line 43 of file DebugReporter.h.

Constructor & Destructor Documentation

◆ DebugReporter()

souffle::ast::transform::DebugReporter::DebugReporter ( Own< Transformer wrappedTransformer)
inline

Definition at line 51 of file DebugReporter.h.

Referenced by disableTransformers().

Member Function Documentation

◆ clone()

DebugReporter* souffle::ast::transform::DebugReporter::clone ( ) const
inlineoverridevirtual

Implements souffle::ast::transform::MetaTransformer.

Definition at line 78 of file DebugReporter.h.

◆ disableTransformers()

void souffle::ast::transform::DebugReporter::disableTransformers ( const std::set< std::string > &  transforms)
inlineoverridevirtual

Implements souffle::ast::transform::MetaTransformer.

Definition at line 66 of file DebugReporter.h.

66  {
68  }
69 
70 private:
71  Own<Transformer> wrappedTransformer;
72 

References souffle::clone(), DebugReporter(), and wrappedTransformer.

Here is the call graph for this function:

◆ generateDebugReport()

void souffle::ast::transform::DebugReporter::generateDebugReport ( TranslationUnit tu,
const std::string &  preTransformDatalog 
)
private

Definition at line 49 of file DebugReporter.cpp.

Referenced by transform().

◆ getName()

std::string souffle::ast::transform::DebugReporter::getName ( ) const
inlineoverridevirtual

Implements souffle::ast::transform::Transformer.

Definition at line 74 of file DebugReporter.h.

◆ getSubtransformers()

std::vector<Transformer*> souffle::ast::transform::DebugReporter::getSubtransformers ( ) const
inlineoverridevirtual

Implements souffle::ast::transform::MetaTransformer.

Definition at line 53 of file DebugReporter.h.

54  {
55  if (auto* mt = dynamic_cast<MetaTransformer*>(wrappedTransformer.get())) {

References wrappedTransformer.

◆ setDebugReport()

void souffle::ast::transform::DebugReporter::setDebugReport ( )
inlineoverridevirtual

Implements souffle::ast::transform::MetaTransformer.

Definition at line 57 of file DebugReporter.h.

57 {

◆ setVerbosity()

void souffle::ast::transform::DebugReporter::setVerbosity ( bool  verbose)
inlineoverridevirtual

Implements souffle::ast::transform::MetaTransformer.

Definition at line 59 of file DebugReporter.h.

62  {
63  return "DebugReporter";
64  }

◆ transform()

bool souffle::ast::transform::DebugReporter::transform ( TranslationUnit translationUnit)
overrideprivatevirtual

Implements souffle::ast::transform::Transformer.

Definition at line 32 of file DebugReporter.cpp.

33  {
34  generateDebugReport(translationUnit, datalogSpecOriginal);
35  }
36 
37  auto elapsed = std::to_string(std::chrono::duration<double>(end - start).count());
38  translationUnit.getDebugReport().endSection(wrappedTransformer->getName(),
39  wrappedTransformer->getName() + " (" + elapsed + "s)" + (changed ? "" : " (unchanged)"));
40  return changed;
41 }
42 
43 void DebugReporter::generateDebugReport(TranslationUnit& tu, const std::string& preTransformDatalog) {
44  tu.getDebugReport().addCodeSection(
45  "dl", "Datalog", "souffle", preTransformDatalog, pprint(tu.getProgram()));
46 }
47 

References generateDebugReport().

Here is the call graph for this function:

Field Documentation

◆ wrappedTransformer

Own<Transformer> souffle::ast::transform::DebugReporter::wrappedTransformer
private

Definition at line 83 of file DebugReporter.h.

Referenced by disableTransformers(), and getSubtransformers().


The documentation for this class was generated from the following files:
souffle::ast::transform::DebugReporter::DebugReporter
DebugReporter(Own< Transformer > wrappedTransformer)
Definition: DebugReporter.h:51
souffle::ast::pprint
std::string pprint(const Node &node)
Definition: Utils.cpp:59
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::ast::transform::DebugReporter::generateDebugReport
void generateDebugReport(TranslationUnit &tu, const std::string &preTransformDatalog)
Definition: DebugReporter.cpp:49
souffle::test::count
int count(const C &c)
Definition: table_test.cpp:40
souffle::ast::transform::DebugReporter::wrappedTransformer
Own< Transformer > wrappedTransformer
Definition: DebugReporter.h:83