/builds/2mk6rsew/0/parcoach/parcoach/src/include/parcoach/SerializableWarning.h
Line | Count | Source |
1 | | #pragma once |
2 | | |
3 | | #include "parcoach/Warning.h" |
4 | | |
5 | | #include "llvm/Support/Error.h" |
6 | | |
7 | | #include <string> |
8 | | #include <vector> |
9 | | |
10 | | namespace llvm { |
11 | | class raw_fd_ostream; |
12 | | } |
13 | | |
14 | | namespace parcoach::serialization::sonar { |
15 | | |
16 | | struct TextRange { |
17 | | int Line{}; |
18 | | }; |
19 | | |
20 | | struct Location { |
21 | | std::string Filename{}; |
22 | | TextRange Range{}; |
23 | | std::string Message{}; |
24 | | }; |
25 | | |
26 | | struct Warning { |
27 | | Location Message{}; |
28 | | using SecondaryLocationsTy = std::vector<Location>; |
29 | | SecondaryLocationsTy Conditionals{}; |
30 | 3 | Warning() = default; |
31 | | Warning(parcoach::Warning const &W); |
32 | | }; |
33 | | |
34 | | struct Database { |
35 | | std::vector<Warning> Issues; |
36 | | void append(WarningCollection const &Warnings); |
37 | | void write(llvm::raw_fd_ostream &Os) const; |
38 | | static llvm::Expected<Database> load(llvm::StringRef Json); |
39 | | }; |
40 | | } // namespace parcoach::serialization::sonar |