1 /*===-- CXLoadedDiagnostic.h - Handling of persisent diags ------*- C++ -*-===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* Implements handling of persisent diagnostics. *|
12 \*===----------------------------------------------------------------------===*/
14 #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXLOADEDDIAGNOSTIC_H
15 #define LLVM_CLANG_TOOLS_LIBCLANG_CXLOADEDDIAGNOSTIC_H
17 #include "CIndexDiagnostic.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "clang/Basic/LLVM.h"
23 class CXLoadedDiagnostic : public CXDiagnosticImpl {
25 CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind),
26 severity(0), category(0) {}
28 ~CXLoadedDiagnostic() override;
30 /// Return the severity of the diagnostic.
31 CXDiagnosticSeverity getSeverity() const override;
33 /// Return the location of the diagnostic.
34 CXSourceLocation getLocation() const override;
36 /// Return the spelling of the diagnostic.
37 CXString getSpelling() const override;
39 /// Return the text for the diagnostic option.
40 CXString getDiagnosticOption(CXString *Disable) const override;
42 /// Return the category of the diagnostic.
43 unsigned getCategory() const override;
45 /// Return the category string of the diagnostic.
46 CXString getCategoryText() const override;
48 /// Return the number of source ranges for the diagnostic.
49 unsigned getNumRanges() const override;
51 /// Return the source ranges for the diagnostic.
52 CXSourceRange getRange(unsigned Range) const override;
54 /// Return the number of FixIts.
55 unsigned getNumFixIts() const override;
57 /// Return the FixIt information (source range and inserted text).
58 CXString getFixIt(unsigned FixIt,
59 CXSourceRange *ReplacementRange) const override;
61 static bool classof(const CXDiagnosticImpl *D) {
62 return D->getKind() == LoadedDiagnosticKind;
65 /// Decode the CXSourceLocation into file, line, column, and offset.
66 static void decodeLocation(CXSourceLocation location,
78 Location() : line(0), column(0), offset(0) {}
83 std::vector<CXSourceRange> Ranges;
84 std::vector<std::pair<CXSourceRange, const char *> > FixIts;
86 llvm::StringRef DiagOption;
87 llvm::StringRef CategoryText;