1 //===-- ClangDiagnostic.h ---------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H
14 #include "clang/Basic/Diagnostic.h"
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-types.h"
19 #include "lldb/Expression/DiagnosticManager.h"
21 namespace lldb_private
{
23 class ClangDiagnostic
: public Diagnostic
{
25 typedef std::vector
<clang::FixItHint
> FixItList
;
27 static inline bool classof(const ClangDiagnostic
*) { return true; }
28 static inline bool classof(const Diagnostic
*diag
) {
29 return diag
->getKind() == eDiagnosticOriginClang
;
32 ClangDiagnostic(llvm::StringRef message
, DiagnosticSeverity severity
,
34 : Diagnostic(message
, severity
, eDiagnosticOriginClang
, compiler_id
) {}
36 ~ClangDiagnostic() override
= default;
38 bool HasFixIts() const override
{ return !m_fixit_vec
.empty(); }
40 void AddFixitHint(const clang::FixItHint
&fixit
) {
41 m_fixit_vec
.push_back(fixit
);
44 const FixItList
&FixIts() const { return m_fixit_vec
; }
46 FixItList m_fixit_vec
;
49 } // namespace lldb_private
50 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H