souffle  2.0.2-371-g6315b36
Meta.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 Meta.h
12  *
13  * Defines the interface for AST meta-transformation passes.
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ast/TranslationUnit.h"
21 #include <set>
22 #include <string>
23 #include <vector>
24 
25 namespace souffle::ast::transform {
26 
27 /**
28  * Transformer that coordinates other sub-transformations
29  */
30 class MetaTransformer : public Transformer {
31 protected:
32  bool verbose = false;
33 
34 public:
35  /* Get subtransformers */
36  virtual std::vector<Transformer*> getSubtransformers() const = 0;
37 
38  /* Enable the debug-report for all sub-transformations */
39  virtual void setDebugReport() = 0;
40 
41  /* Enable high verbosity */
42  virtual void setVerbosity(bool verbose) = 0;
43 
44  /* Disable subtransformers */
45  virtual void disableTransformers(const std::set<std::string>& transforms) = 0;
46 
47  /* Apply a nested transformer */
48  bool applySubtransformer(TranslationUnit& translationUnit, Transformer* transformer);
49 
50  MetaTransformer* clone() const override = 0;
51 };
52 
53 } // namespace souffle::ast::transform
souffle::ast::transform::MetaTransformer::disableTransformers
virtual void disableTransformers(const std::set< std::string > &transforms)=0
TranslationUnit.h
souffle::ast::transform::MetaTransformer
Transformer that coordinates other sub-transformations.
Definition: Meta.h:36
souffle::ast::transform::MetaTransformer::getSubtransformers
virtual std::vector< Transformer * > getSubtransformers() const =0
Transformer.h
souffle::ast::transform::Transformer
Definition: Transformer.h:30
souffle::ast::transform::MetaTransformer::verbose
bool verbose
Definition: Meta.h:44
souffle::ast::transform::MetaTransformer::setDebugReport
virtual void setDebugReport()=0
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform::MetaTransformer::clone
MetaTransformer * clone() const override=0
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::MetaTransformer::setVerbosity
virtual void setVerbosity(bool verbose)=0
souffle::ast::transform::MetaTransformer::applySubtransformer
bool applySubtransformer(TranslationUnit &translationUnit, Transformer *transformer)
Definition: Meta.cpp:30