souffle  2.0.2-371-g6315b36
Transformer.cpp
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.cpp
12  *
13  * Defines the interface for AST transformation passes.
14  *
15  ***********************************************************************/
16 
18 #include "ast/TranslationUnit.h"
19 #include "reports/ErrorReport.h"
20 
21 namespace souffle::ast::transform {
22 
23 bool Transformer::apply(TranslationUnit& translationUnit) {
24  // invoke the transformation
25  bool changed = transform(translationUnit);
26 
27  if (changed) {
28  translationUnit.invalidateAnalyses();
29  }
30 
31  /* Abort evaluation of the program if errors were encountered */
32  translationUnit.getErrorReport().exitIfErrors();
33 
34  return changed;
35 }
36 
37 } // namespace souffle::ast::transform
TranslationUnit.h
Transformer.h
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
ErrorReport.h