2011-11-10 16:43:12 +08:00
|
|
|
/*===-- CXLoadedDiagnostic.h - Handling of persisent diags ------*- C++ -*-===*\
|
|
|
|
|* *|
|
|
|
|
|* The LLVM Compiler Infrastructure *|
|
|
|
|
|* *|
|
|
|
|
|* This file is distributed under the University of Illinois Open Source *|
|
|
|
|
|* License. See LICENSE.TXT for details. *|
|
|
|
|
|* *|
|
|
|
|
|*===----------------------------------------------------------------------===*|
|
|
|
|
|* *|
|
|
|
|
|* Implements handling of persisent diagnostics. *|
|
|
|
|
|* *|
|
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_CINDEX_LOADED_DIAGNOSTIC_H
|
|
|
|
#define LLVM_CLANG_CINDEX_LOADED_DIAGNOSTIC_H
|
|
|
|
|
|
|
|
#include "CIndexDiagnostic.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
#include "clang/Basic/LLVM.h"
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
class CXLoadedDiagnostic : public CXDiagnosticImpl {
|
|
|
|
public:
|
|
|
|
CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind),
|
|
|
|
severity(0), category(0) {}
|
|
|
|
|
|
|
|
virtual ~CXLoadedDiagnostic();
|
|
|
|
|
|
|
|
/// \brief Return the severity of the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXDiagnosticSeverity getSeverity() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the location of the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXSourceLocation getLocation() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the spelling of the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXString getSpelling() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the text for the diagnostic option.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXString getDiagnosticOption(CXString *Disable) const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the category of the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
unsigned getCategory() const override;
|
|
|
|
|
2012-04-12 08:03:31 +08:00
|
|
|
/// \brief Return the category string of the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXString getCategoryText() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the number of source ranges for the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
unsigned getNumRanges() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the source ranges for the diagnostic.
|
2014-03-15 15:47:46 +08:00
|
|
|
CXSourceRange getRange(unsigned Range) const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the number of FixIts.
|
2014-03-15 15:47:46 +08:00
|
|
|
unsigned getNumFixIts() const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
/// \brief Return the FixIt information (source range and inserted text).
|
2014-03-15 15:47:46 +08:00
|
|
|
CXString getFixIt(unsigned FixIt,
|
|
|
|
CXSourceRange *ReplacementRange) const override;
|
|
|
|
|
2011-11-10 16:43:12 +08:00
|
|
|
static bool classof(const CXDiagnosticImpl *D) {
|
|
|
|
return D->getKind() == LoadedDiagnosticKind;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \brief Decode the CXSourceLocation into file, line, column, and offset.
|
|
|
|
static void decodeLocation(CXSourceLocation location,
|
|
|
|
CXFile *file,
|
|
|
|
unsigned *line,
|
|
|
|
unsigned *column,
|
|
|
|
unsigned *offset);
|
|
|
|
|
|
|
|
struct Location {
|
|
|
|
CXFile file;
|
|
|
|
unsigned line;
|
|
|
|
unsigned column;
|
|
|
|
unsigned offset;
|
|
|
|
|
|
|
|
Location() : line(0), column(0), offset(0) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
Location DiagLoc;
|
|
|
|
|
|
|
|
std::vector<CXSourceRange> Ranges;
|
2013-02-19 03:50:38 +08:00
|
|
|
std::vector<std::pair<CXSourceRange, const char *> > FixIts;
|
|
|
|
const char *Spelling;
|
2011-11-10 16:43:12 +08:00
|
|
|
llvm::StringRef DiagOption;
|
2012-04-12 08:03:31 +08:00
|
|
|
llvm::StringRef CategoryText;
|
2011-11-10 16:43:12 +08:00
|
|
|
unsigned severity;
|
|
|
|
unsigned category;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|