1061da546Spatrick //===-- ClangDiagnostic.h ---------------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9*dda28197Spatrick #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H 10*dda28197Spatrick #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H 11061da546Spatrick 12061da546Spatrick #include <vector> 13061da546Spatrick 14061da546Spatrick #include "clang/Basic/Diagnostic.h" 15061da546Spatrick 16061da546Spatrick #include "lldb/lldb-defines.h" 17061da546Spatrick #include "lldb/lldb-types.h" 18061da546Spatrick 19061da546Spatrick #include "lldb/Expression/DiagnosticManager.h" 20061da546Spatrick 21061da546Spatrick namespace lldb_private { 22061da546Spatrick 23061da546Spatrick class ClangDiagnostic : public Diagnostic { 24061da546Spatrick public: 25061da546Spatrick typedef std::vector<clang::FixItHint> FixItList; 26061da546Spatrick classof(const ClangDiagnostic *)27061da546Spatrick static inline bool classof(const ClangDiagnostic *) { return true; } classof(const Diagnostic * diag)28061da546Spatrick static inline bool classof(const Diagnostic *diag) { 29061da546Spatrick return diag->getKind() == eDiagnosticOriginClang; 30061da546Spatrick } 31061da546Spatrick ClangDiagnostic(llvm::StringRef message,DiagnosticSeverity severity,uint32_t compiler_id)32061da546Spatrick ClangDiagnostic(llvm::StringRef message, DiagnosticSeverity severity, 33061da546Spatrick uint32_t compiler_id) 34061da546Spatrick : Diagnostic(message, severity, eDiagnosticOriginClang, compiler_id) {} 35061da546Spatrick 36061da546Spatrick ~ClangDiagnostic() override = default; 37061da546Spatrick HasFixIts()38061da546Spatrick bool HasFixIts() const override { return !m_fixit_vec.empty(); } 39061da546Spatrick AddFixitHint(const clang::FixItHint & fixit)40061da546Spatrick void AddFixitHint(const clang::FixItHint &fixit) { 41061da546Spatrick m_fixit_vec.push_back(fixit); 42061da546Spatrick } 43061da546Spatrick FixIts()44061da546Spatrick const FixItList &FixIts() const { return m_fixit_vec; } 45061da546Spatrick private: 46061da546Spatrick FixItList m_fixit_vec; 47061da546Spatrick }; 48061da546Spatrick 49061da546Spatrick } // namespace lldb_private 50*dda28197Spatrick #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H 51