• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cstddef>
24 #include <optional>
25 #include <ostream>
26 #include <string_view>
27 
28 #include "comparison.h"
29 #include "fidelity.h"
30 #include "graph.h"
31 #include "naming.h"
32 
33 namespace stg {
34 namespace reporting {
35 
36 enum class OutputFormat { PLAIN, FLAT, SMALL, SHORT, VIZ };
37 
38 std::optional<OutputFormat> ParseOutputFormat(std::string_view format);
39 
40 struct OutputFormatUsage {};
41 std::ostream& operator<<(std::ostream&, OutputFormatUsage);
42 
43 struct Options {
44   const OutputFormat format;
45   const size_t max_crc_only_changes;  // only for SHORT
46 };
47 
48 struct Reporting {
49   const Graph& graph;
50   const Outcomes& outcomes;
51   const Options& options;
52   NameCache& names;
53 };
54 
55 void Report(const Reporting&, const Comparison&, std::ostream&);
56 
57 bool FidelityDiff(const stg::FidelityDiff&, std::ostream&);
58 
59 }  // namespace reporting
60 }  // namespace stg
61 
62 #endif  // STG_REPORTING_H_
63