LLDB mainline
ClangHighlighter.h
Go to the documentation of this file.
1//===-- ClangHighlighter.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_HIGHLIGHTER_CLANG_CLANGHIGHLIGHTER_H
10#define LLDB_SOURCE_PLUGINS_HIGHLIGHTER_CLANG_CLANGHIGHLIGHTER_H
11
12#include "lldb/Utility/Stream.h"
13#include "llvm/ADT/StringSet.h"
14
16#include <optional>
17
18namespace lldb_private {
19
21 llvm::StringSet<> keywords;
22
23public:
25 llvm::StringRef GetName() const override { return "clang"; }
26
27 void Highlight(const HighlightStyle &options, llvm::StringRef line,
28 std::optional<size_t> cursor_pos,
29 llvm::StringRef previous_lines, Stream &s) const override;
30
31 /// Returns true if the given string represents a keywords in any Clang
32 /// supported language.
33 bool isKeyword(llvm::StringRef token) const;
34
36
37 static void Terminate();
38 static void Initialize();
39
40 static llvm::StringRef GetPluginNameStatic() { return "Clang Highlighter"; }
41 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
42};
43
44} // namespace lldb_private
45
46#endif
static llvm::StringRef GetPluginNameStatic()
static Highlighter * CreateInstance(lldb::LanguageType language)
llvm::StringRef GetPluginName() override
void Highlight(const HighlightStyle &options, llvm::StringRef line, std::optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const override
Highlights the given line.
bool isKeyword(llvm::StringRef token) const
Returns true if the given string represents a keywords in any Clang supported language.
llvm::StringRef GetName() const override
Returns a human readable name for the selected highlighter.
Annotates source code with color attributes.
Definition Highlighter.h:96
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
LanguageType
Programming language type.
Represents style that the highlighter should apply to the given source code.
Definition Highlighter.h:25