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

Translation unit class for the translation pipeline. More...

#include <TranslationUnit.h>

Collaboration diagram for souffle::ast::TranslationUnit:
Collaboration graph

Public Member Functions

template<class Analysis >
AnalysisgetAnalysis () const
 get analysis: analysis is generated on the fly if not present More...
 
DebugReportgetDebugReport ()
 Return debug report. More...
 
ErrorReportgetErrorReport ()
 Return error report. More...
 
ProgramgetProgram () const
 Return the program. More...
 
void invalidateAnalyses () const
 Destroy all cached analyses of translation unit. More...
 
 TranslationUnit (Own< Program > program, ErrorReport &e, DebugReport &d)
 
virtual ~TranslationUnit ()=default
 

Private Attributes

std::map< std::string, Own< analysis::Analysis > > analyses
 Cached analyses. More...
 
DebugReportdebugReport
 HTML debug report. More...
 
ErrorReporterrorReport
 Error report capturing errors while compiling. More...
 
Own< Programprogram
 AST program. More...
 

Detailed Description

Translation unit class for the translation pipeline.

The translation unit class consisting of an symbol table, AST program, error reports, and cached analysis results.

Definition at line 51 of file TranslationUnit.h.

Constructor & Destructor Documentation

◆ TranslationUnit()

souffle::ast::TranslationUnit::TranslationUnit ( Own< Program program,
ErrorReport e,
DebugReport d 
)
inline

Definition at line 53 of file TranslationUnit.h.

54  {

References analyses, and souffle::Global::config().

Here is the call graph for this function:

◆ ~TranslationUnit()

virtual souffle::ast::TranslationUnit::~TranslationUnit ( )
virtualdefault

Member Function Documentation

◆ getAnalysis()

template<class Analysis >
Analysis* souffle::ast::TranslationUnit::getAnalysis ( ) const
inline

get analysis: analysis is generated on the fly if not present

Definition at line 60 of file TranslationUnit.h.

62  {
63  std::stringstream ss;
64  analyses[name]->print(ss);
65  if (!isA<analysis::PrecedenceGraphAnalysis>(analyses[name].get()) &&
66  !isA<analysis::SCCGraphAnalysis>(analyses[name].get())) {
67  debugReport.addSection(name, "Ast Analysis [" + name + "]", ss.str());
68  } else {
70  DebugReportSection(name, "Ast Analysis [" + name + "]", {}, ss.str()));
71  }
72  }
73  }
74  return dynamic_cast<Analysis*>(analyses[name].get());
75  }
76 
77  /** Return the program */
78  Program& getProgram() const {
79  assert(program && "NULL program");
80  return *program.get();
81  }

Referenced by souffle::ast::transform::IOAttributesTransformer::clone(), and souffle::ast::transform::MagicSetTransformer::LabelDatabaseTransformer::isNegativelyLabelled().

◆ getDebugReport()

DebugReport& souffle::ast::TranslationUnit::getDebugReport ( )
inline

Return debug report.

Definition at line 100 of file TranslationUnit.h.

◆ getErrorReport()

ErrorReport& souffle::ast::TranslationUnit::getErrorReport ( )
inline

Return error report.

Definition at line 90 of file TranslationUnit.h.

94  {

◆ getProgram()

Program& souffle::ast::TranslationUnit::getProgram ( ) const
inline

◆ invalidateAnalyses()

void souffle::ast::TranslationUnit::invalidateAnalyses ( ) const
inline

Destroy all cached analyses of translation unit.

Definition at line 95 of file TranslationUnit.h.

98  :
99  /** Cached analyses */

Field Documentation

◆ analyses

std::map<std::string, Own<analysis::Analysis> > souffle::ast::TranslationUnit::analyses
mutableprivate

Cached analyses.

Definition at line 106 of file TranslationUnit.h.

Referenced by TranslationUnit().

◆ debugReport

DebugReport& souffle::ast::TranslationUnit::debugReport
private

HTML debug report.

Definition at line 115 of file TranslationUnit.h.

◆ errorReport

ErrorReport& souffle::ast::TranslationUnit::errorReport
private

Error report capturing errors while compiling.

Definition at line 112 of file TranslationUnit.h.

Referenced by getProgram().

◆ program

Own<Program> souffle::ast::TranslationUnit::program
private

AST program.

Definition at line 109 of file TranslationUnit.h.


The documentation for this class was generated from the following file:
souffle::ast::TranslationUnit::program
Own< Program > program
AST program.
Definition: TranslationUnit.h:109
souffle::DebugReport::addSection
void addSection(DebugReportSection section)
Definition: DebugReport.h:93
TCB_SPAN_NAMESPACE_NAME::get
constexpr auto get(span< E, S > s) -> decltype(s[N])
Definition: span.h:599
souffle::ast::TranslationUnit::analyses
std::map< std::string, Own< analysis::Analysis > > analyses
Cached analyses.
Definition: TranslationUnit.h:106
souffle::ast::TranslationUnit::getProgram
Program & getProgram() const
Return the program.
Definition: TranslationUnit.h:84
souffle::ast::TranslationUnit::debugReport
DebugReport & debugReport
HTML debug report.
Definition: TranslationUnit.h:115
souffle::ast::TranslationUnit::errorReport
ErrorReport & errorReport
Error report capturing errors while compiling.
Definition: TranslationUnit.h:112
souffle::profile::ss
class souffle::profile::Tui ss
Definition: Tui.h:336