ClangDiagnostic.h revision 341825
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 24class ClangDiagnostic : public Diagnostic { 25public: 26 typedef std::vector<clang::FixItHint> FixItList; 27 28 static inline bool classof(const ClangDiagnostic *) { return true; } 29 static inline bool classof(const Diagnostic *diag) { 30 return diag->getKind() == eDiagnosticOriginClang; 31 } 32 33 ClangDiagnostic(const char *message, DiagnosticSeverity severity, 34 uint32_t compiler_id) 35 : Diagnostic(message, severity, eDiagnosticOriginClang, compiler_id) {} 36 37 virtual ~ClangDiagnostic() = default; 38 39 bool HasFixIts() const override { return !m_fixit_vec.empty(); } 40 41 void AddFixitHint(const clang::FixItHint &fixit) { 42 m_fixit_vec.push_back(fixit); 43 } 44 45 const FixItList &FixIts() const { return m_fixit_vec; } 46 FixItList m_fixit_vec; 47}; 48 49} // namespace lldb_private 50#endif /* lldb_ClangDiagnostic_h */ 51