• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LANGUAGE_CLANGCOMMON_CLANGHIGHLIGHTER_H
10 #define LLDB_SOURCE_PLUGINS_LANGUAGE_CLANGCOMMON_CLANGHIGHLIGHTER_H
11 
12 #include "lldb/Utility/Stream.h"
13 #include "llvm/ADT/StringSet.h"
14 
15 #include "lldb/Core/Highlighter.h"
16 
17 namespace lldb_private {
18 
19 class ClangHighlighter : public Highlighter {
20   llvm::StringSet<> keywords;
21 
22 public:
23   ClangHighlighter();
GetName()24   llvm::StringRef GetName() const override { return "clang"; }
25 
26   void Highlight(const HighlightStyle &options, llvm::StringRef line,
27                  llvm::Optional<size_t> cursor_pos,
28                  llvm::StringRef previous_lines, Stream &s) const override;
29 
30   /// Returns true if the given string represents a keywords in any Clang
31   /// supported language.
32   bool isKeyword(llvm::StringRef token) const;
33 };
34 
35 } // namespace lldb_private
36 
37 #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CLANGCOMMON_CLANGHIGHLIGHTER_H
38