1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXLOADEDDIAGNOSTIC_H |
15 | #define LLVM_CLANG_TOOLS_LIBCLANG_CXLOADEDDIAGNOSTIC_H |
16 | |
17 | #include "CIndexDiagnostic.h" |
18 | #include "llvm/ADT/StringRef.h" |
19 | #include "clang/Basic/LLVM.h" |
20 | #include <vector> |
21 | |
22 | namespace clang { |
23 | class CXLoadedDiagnostic : public CXDiagnosticImpl { |
24 | public: |
25 | CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind), |
26 | severity(0), category(0) {} |
27 | |
28 | ~CXLoadedDiagnostic() override; |
29 | |
30 | |
31 | CXDiagnosticSeverity getSeverity() const override; |
32 | |
33 | |
34 | CXSourceLocation getLocation() const override; |
35 | |
36 | |
37 | CXString getSpelling() const override; |
38 | |
39 | |
40 | CXString getDiagnosticOption(CXString *Disable) const override; |
41 | |
42 | |
43 | unsigned getCategory() const override; |
44 | |
45 | |
46 | CXString getCategoryText() const override; |
47 | |
48 | |
49 | unsigned getNumRanges() const override; |
50 | |
51 | |
52 | CXSourceRange getRange(unsigned Range) const override; |
53 | |
54 | |
55 | unsigned getNumFixIts() const override; |
56 | |
57 | |
58 | CXString getFixIt(unsigned FixIt, |
59 | CXSourceRange *ReplacementRange) const override; |
60 | |
61 | static bool classof(const CXDiagnosticImpl *D) { |
62 | return D->getKind() == LoadedDiagnosticKind; |
63 | } |
64 | |
65 | |
66 | static void decodeLocation(CXSourceLocation location, |
67 | CXFile *file, |
68 | unsigned *line, |
69 | unsigned *column, |
70 | unsigned *offset); |
71 | |
72 | struct Location { |
73 | CXFile file; |
74 | unsigned line; |
75 | unsigned column; |
76 | unsigned offset; |
77 | |
78 | Location() : line(0), column(0), offset(0) {} |
79 | }; |
80 | |
81 | Location DiagLoc; |
82 | |
83 | std::vector<CXSourceRange> Ranges; |
84 | std::vector<std::pair<CXSourceRange, const char *> > FixIts; |
85 | const char *Spelling; |
86 | llvm::StringRef DiagOption; |
87 | llvm::StringRef CategoryText; |
88 | unsigned severity; |
89 | unsigned category; |
90 | }; |
91 | } |
92 | |
93 | #endif |
94 | |