souffle  2.0.2-371-g6315b36
Transformer.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file Transformer.h
12  *
13  * Defines the interface for AST transformation passes.
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ast/TranslationUnit.h"
20 #include <string>
21 
22 namespace souffle::ast::transform {
23 
24 class Transformer {
25 private:
26  virtual bool transform(TranslationUnit& translationUnit) = 0;
27 
28 public:
29  virtual ~Transformer() = default;
30 
31  bool apply(TranslationUnit& translationUnit);
32 
33  virtual std::string getName() const = 0;
34 
35  virtual Transformer* clone() const = 0;
36 };
37 
38 } // namespace souffle::ast::transform
TranslationUnit.h
souffle::ast::transform::Transformer::clone
virtual Transformer * clone() const =0
souffle::ast::transform::Transformer
Definition: Transformer.h:30
souffle::ast::transform::Transformer::getName
virtual std::string getName() const =0
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform::Transformer::~Transformer
virtual ~Transformer()=default
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::Transformer::transform
virtual bool transform(TranslationUnit &translationUnit)=0
souffle::ast::transform::Transformer::apply
bool apply(TranslationUnit &translationUnit)
Definition: Transformer.cpp:29