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

#include <GroundedTermsChecker.h>

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

Public Member Functions

GroundedTermsCheckerclone () const override
 
std::string getName () const override
 
void verify (TranslationUnit &translationUnit)
 
- Public Member Functions inherited from souffle::ast::transform::Transformer
bool apply (TranslationUnit &translationUnit)
 
virtual ~Transformer ()=default
 

Private Member Functions

bool transform (TranslationUnit &translationUnit) override
 

Detailed Description

Definition at line 31 of file GroundedTermsChecker.h.

Member Function Documentation

◆ clone()

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

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

Definition at line 46 of file GroundedTermsChecker.h.

◆ getName()

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

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

Definition at line 39 of file GroundedTermsChecker.h.

39  {
40  verify(translationUnit);
41  return false;

References verify().

Here is the call graph for this function:

◆ transform()

bool souffle::ast::transform::GroundedTermsChecker::transform ( TranslationUnit translationUnit)
inlineoverrideprivatevirtual

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

Definition at line 51 of file GroundedTermsChecker.h.

◆ verify()

void souffle::ast::transform::GroundedTermsChecker::verify ( TranslationUnit translationUnit)

Definition at line 41 of file GroundedTermsChecker.cpp.

47  : getVariables(clause)) {
48  if (!isGrounded[cur] && reportedVars.insert(cur->getName()).second) {
49  report.addError("Ungrounded variable " + cur->getName(), cur->getSrcLoc());
50  }
51  }
52 
53  // all records need to be grounded
54  visitDepthFirst(clause, [&](const RecordInit& record) {
55  if (!isGrounded[&record]) {
56  report.addError("Ungrounded record", record.getSrcLoc());
57  }
58  });
59 
60  // All sums need to be grounded
61  visitDepthFirst(clause, [&](const BranchInit& adt) {
62  if (!isGrounded[&adt]) {
63  report.addError("Ungrounded ADT branch", adt.getSrcLoc());
64  }
65  });
66  });
67 }
68 
69 } // namespace souffle::ast::transform

Referenced by getName().


The documentation for this class was generated from the following files:
souffle::ast::transform::GroundedTermsChecker::verify
void verify(TranslationUnit &translationUnit)
Definition: GroundedTermsChecker.cpp:41
souffle::ast::getVariables
std::vector< const Variable * > getVariables(const Node &root)
Obtains a list of all variables referenced within the AST rooted by the given root node.
Definition: Utils.cpp:63
souffle::ast::visitDepthFirst
void visitDepthFirst(const Node &root, Visitor< R, Ps... > &visitor, Args &... args)
A utility function visiting all nodes within the ast rooted by the given node recursively in a depth-...
Definition: Visitor.h:273