1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 // -*- mode: C++ -*- 3 // 4 // Copyright 2020-2022 Google LLC 5 // 6 // Licensed under the Apache License v2.0 with LLVM Exceptions (the 7 // "License"); you may not use this file except in compliance with the 8 // License. You may obtain a copy of the License at 9 // 10 // https://llvm.org/LICENSE.txt 11 // 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 // See the License for the specific language governing permissions and 16 // limitations under the License. 17 // 18 // Author: Giuliano Procida 19 20 #ifndef STG_REPORTING_H_ 21 #define STG_REPORTING_H_ 22 23 #include <optional> 24 #include <ostream> 25 #include <string_view> 26 27 #include "comparison.h" 28 #include "fidelity.h" 29 #include "graph.h" 30 #include "naming.h" 31 32 namespace stg { 33 namespace reporting { 34 35 enum class OutputFormat { PLAIN, FLAT, SMALL, SHORT, VIZ }; 36 37 std::optional<OutputFormat> ParseOutputFormat(std::string_view format); 38 39 struct OutputFormatUsage {}; 40 std::ostream& operator<<(std::ostream&, OutputFormatUsage); 41 42 struct Options { 43 const OutputFormat format; 44 }; 45 46 struct Reporting { 47 const Graph& graph; 48 const diff::Outcomes& outcomes; 49 const Options& options; 50 NameCache& names; 51 }; 52 53 void Report(const Reporting&, const diff::Comparison&, std::ostream&); 54 55 bool FidelityDiff(const stg::FidelityDiff&, std::ostream&); 56 57 } // namespace reporting 58 } // namespace stg 59 60 #endif // STG_REPORTING_H_ 61