Ejemplo n.º 1
0
void DebugReporter::generateDebugReport(
        AstTranslationUnit& translationUnit, std::string id, std::string title) {
    std::stringstream datalogSpec;
    translationUnit.getProgram()->print(datalogSpec);

    DebugReportSection datalogSection = getCodeSection(id + "-dl", "Datalog", datalogSpec.str());

    std::stringstream precGraphDot;
    translationUnit.getAnalysis<PrecedenceGraph>()->outputPrecedenceGraph(precGraphDot);
    DebugReportSection precedenceGraphSection =
            getDotGraphSection(id + "-prec-graph", "Precedence Graph", precGraphDot.str());

    std::stringstream sccGraphDot;
    translationUnit.getAnalysis<SCCGraph>()->outputSCCGraph(sccGraphDot);
    DebugReportSection sccGraphSection =
            getDotGraphSection(id + "-scc-graph", "SCC Graph", sccGraphDot.str());

    std::stringstream topsortSCCGraph;
    translationUnit.getAnalysis<TopologicallySortedSCCGraph>()->outputTopologicallySortedSCCGraph(
            topsortSCCGraph);
    DebugReportSection topsortSCCGraphSection =
            getCodeSection(id + "-topsort-scc-graph", "SCC Topological Sort Order", topsortSCCGraph.str());

    std::stringstream adornment;
    translationUnit.getAnalysis<Adornment>()->outputAdornment(adornment);
    DebugReportSection adornmentSection =
            getCodeSection(id + "-adornment-display", "Adornment", adornment.str());

    translationUnit.getDebugReport().addSection(
            DebugReportSection(id, title, {datalogSection, precedenceGraphSection, sccGraphSection,
                                                  topsortSCCGraphSection, adornmentSection},
                    ""));
}
Ejemplo n.º 2
0
void DebugReporter::generateDebugReport(
        AstTranslationUnit& translationUnit, const std::string& id, std::string title) {
    std::stringstream datalogSpec;
    translationUnit.getProgram()->print(datalogSpec);

    DebugReportSection datalogSection = getCodeSection(id + "-dl", "Datalog", datalogSpec.str());

    std::stringstream typeAnalysis;
    translationUnit.getAnalysis<TypeAnalysis>()->print(typeAnalysis);
    DebugReportSection typeAnalysisSection = getCodeSection(id + "-ta", "Type Analysis", typeAnalysis.str());

    std::stringstream typeEnvironmentAnalysis;
    translationUnit.getAnalysis<TypeEnvironmentAnalysis>()->print(typeEnvironmentAnalysis);
    DebugReportSection typeEnvironmentAnalysisSection =
            getCodeSection(id + "-tea", "Type Environment Analysis", typeEnvironmentAnalysis.str());

    std::stringstream precGraphDot;
    translationUnit.getAnalysis<PrecedenceGraph>()->print(precGraphDot);
    DebugReportSection precedenceGraphSection =
            getDotGraphSection(id + "-prec-graph", "Precedence Graph", precGraphDot.str());

    std::stringstream sccGraphDot;
    translationUnit.getAnalysis<SCCGraph>()->print(sccGraphDot);
    DebugReportSection sccGraphSection =
            getDotGraphSection(id + "-scc-graph", "SCC Graph", sccGraphDot.str());

    std::stringstream topsortSCCGraph;
    translationUnit.getAnalysis<TopologicallySortedSCCGraph>()->print(topsortSCCGraph);
    DebugReportSection topsortSCCGraphSection =
            getCodeSection(id + "-topsort-scc-graph", "SCC Topological Sort Order", topsortSCCGraph.str());

    translationUnit.getDebugReport().addSection(DebugReportSection(id, std::move(title),
            {datalogSection, typeAnalysisSection, typeEnvironmentAnalysisSection, precedenceGraphSection,
                    sccGraphSection, topsortSCCGraphSection},
            ""));
}