forked from souffle-lang/souffle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTranslationUnit.cpp
32 lines (27 loc) · 1.1 KB
/
TranslationUnit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Souffle - A Datalog Compiler
* Copyright (c) 2020, The Souffle Developers. All rights reserved
* Licensed under the Universal Permissive License v 1.0 as shown at:
* - https://opensource.org/licenses/UPL
* - <souffle root>/licenses/SOUFFLE-UPL.txt
*/
#include "ast/TranslationUnit.h"
#include "Global.h"
#include "ast/Program.h"
#include "ast/analysis/PrecedenceGraph.h"
#include "ast/analysis/SCCGraph.h"
#include "reports/DebugReport.h"
#include "souffle/utility/StringUtil.h"
namespace souffle::ast {
/** get analysis: analysis is generated on the fly if not present */
void TranslationUnit::logAnalysis(Analysis& analysis) const {
if (!global().config().has("debug-report")) return;
std::string name = analysis.getName();
if (as<analysis::PrecedenceGraphAnalysis>(analysis) || as<analysis::SCCGraphAnalysis>(analysis)) {
debugReport.addSection(
DebugReportSection(name, "Ast Analysis [" + name + "]", {}, toString(analysis)));
} else {
debugReport.addSection(name, "Ast Analysis [" + name + "]", toString(analysis));
}
}
} // namespace souffle::ast