ClangDiagnostic.h revision 303241
1//===-- ClangDiagnostic.h ---------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef lldb_ClangDiagnostic_h 11#define lldb_ClangDiagnostic_h 12 13#include <vector> 14 15#include "clang/Basic/Diagnostic.h" 16 17#include "lldb/lldb-defines.h" 18#include "lldb/lldb-types.h" 19 20#include "lldb/Expression/DiagnosticManager.h" 21 22namespace lldb_private 23{ 24 25 26class ClangDiagnostic : public Diagnostic 27{ 28public: 29 typedef std::vector<clang::FixItHint> FixItList; 30 31 static inline bool classof(const ClangDiagnostic *) { return true; } 32 static inline bool classof(const Diagnostic *diag) { 33 return diag->getKind() == eDiagnosticOriginClang; 34 } 35 36 ClangDiagnostic(const char *message, DiagnosticSeverity severity, uint32_t compiler_id) : 37 Diagnostic(message, severity, eDiagnosticOriginClang, compiler_id) 38 { 39 } 40 41 virtual ~ClangDiagnostic() = default; 42 43 bool HasFixIts () const override { return !m_fixit_vec.empty(); } 44 45 void 46 AddFixitHint (const clang::FixItHint &fixit) 47 { 48 m_fixit_vec.push_back(fixit); 49 } 50 51 const FixItList & 52 FixIts() const 53 { 54 return m_fixit_vec; 55 } 56 FixItList m_fixit_vec; 57}; 58 59} // namespace lldb_private 60#endif /* lldb_ClangDiagnostic_h */ 61