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"
24 class CXLoadedDiagnostic : public CXDiagnosticImpl {
26 CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind),
27 severity(0), category(0) {}
29 virtual ~CXLoadedDiagnostic();
31 /// \brief Return the severity of the diagnostic.
32 CXDiagnosticSeverity getSeverity() const override;
34 /// \brief Return the location of the diagnostic.
35 CXSourceLocation getLocation() const override;
37 /// \brief Return the spelling of the diagnostic.
38 CXString getSpelling() const override;
40 /// \brief Return the text for the diagnostic option.
41 CXString getDiagnosticOption(CXString *Disable) const override;
43 /// \brief Return the category of the diagnostic.
44 unsigned getCategory() const override;
46 /// \brief Return the category string of the diagnostic.
47 CXString getCategoryText() const override;
49 /// \brief Return the number of source ranges for the diagnostic.
50 unsigned getNumRanges() const override;
52 /// \brief Return the source ranges for the diagnostic.
53 CXSourceRange getRange(unsigned Range) const override;
55 /// \brief Return the number of FixIts.
56 unsigned getNumFixIts() const override;
58 /// \brief Return the FixIt information (source range and inserted text).
59 CXString getFixIt(unsigned FixIt,
60 CXSourceRange *ReplacementRange) const override;
62 static bool classof(const CXDiagnosticImpl *D) {
63 return D->getKind() == LoadedDiagnosticKind;
66 /// \brief Decode the CXSourceLocation into file, line, column, and offset.
67 static void decodeLocation(CXSourceLocation location,
79 Location() : line(0), column(0), offset(0) {}
84 std::vector<CXSourceRange> Ranges;
85 std::vector<std::pair<CXSourceRange, const char *> > FixIts;
87 llvm::StringRef DiagOption;
88 llvm::StringRef CategoryText;