LLDB  mainline
ClangDiagnostic.h
Go to the documentation of this file.
1 //===-- ClangDiagnostic.h ---------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H
11 
12 #include <vector>
13 
14 #include "clang/Basic/Diagnostic.h"
15 
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-types.h"
18 
20 
21 namespace lldb_private {
22 
23 class ClangDiagnostic : public Diagnostic {
24 public:
25  typedef std::vector<clang::FixItHint> FixItList;
26 
27  static inline bool classof(const ClangDiagnostic *) { return true; }
28  static inline bool classof(const Diagnostic *diag) {
29  return diag->getKind() == eDiagnosticOriginClang;
30  }
31 
32  ClangDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
33  uint32_t compiler_id)
34  : Diagnostic(message, severity, eDiagnosticOriginClang, compiler_id) {}
35 
36  ~ClangDiagnostic() override = default;
37 
38  bool HasFixIts() const override { return !m_fixit_vec.empty(); }
39 
40  void AddFixitHint(const clang::FixItHint &fixit) {
41  m_fixit_vec.push_back(fixit);
42  }
43 
44  const FixItList &FixIts() const { return m_fixit_vec; }
45 private:
47 };
48 
49 } // namespace lldb_private
50 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDIAGNOSTIC_H
lldb_private::ClangDiagnostic::FixIts
const FixItList & FixIts() const
Definition: ClangDiagnostic.h:44
lldb-defines.h
lldb_private::ClangDiagnostic::AddFixitHint
void AddFixitHint(const clang::FixItHint &fixit)
Definition: ClangDiagnostic.h:40
lldb_private::ClangDiagnostic::~ClangDiagnostic
~ClangDiagnostic() override=default
lldb_private::ClangDiagnostic::classof
static bool classof(const Diagnostic *diag)
Definition: ClangDiagnostic.h:28
lldb_private::ClangDiagnostic::ClangDiagnostic
ClangDiagnostic(llvm::StringRef message, DiagnosticSeverity severity, uint32_t compiler_id)
Definition: ClangDiagnostic.h:32
lldb_private::ClangDiagnostic
Definition: ClangDiagnostic.h:23
lldb_private::eDiagnosticOriginClang
@ eDiagnosticOriginClang
Definition: DiagnosticManager.h:26
lldb_private::ClangDiagnostic::classof
static bool classof(const ClangDiagnostic *)
Definition: ClangDiagnostic.h:27
lldb-types.h
lldb_private::Diagnostic::getKind
DiagnosticOrigin getKind() const
Definition: DiagnosticManager.h:43
uint32_t
message
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
Definition: Plugins/Trace/intel-pt/CMakeLists.txt:6
lldb_private::ClangDiagnostic::HasFixIts
bool HasFixIts() const override
Definition: ClangDiagnostic.h:38
lldb_private::ClangDiagnostic::FixItList
std::vector< clang::FixItHint > FixItList
Definition: ClangDiagnostic.h:25
DiagnosticManager.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Diagnostic
Definition: DiagnosticManager.h:39
lldb_private::DiagnosticSeverity
DiagnosticSeverity
Definition: DiagnosticManager.h:31
lldb_private::ClangDiagnostic::m_fixit_vec
FixItList m_fixit_vec
Definition: ClangDiagnostic.h:46