[Lldb-commits] [lldb] 7c2109f - [lldb] Fix compile error when tree-sitter is enabled
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 16 14:10:39 PST 2026
Author: Jonas Devlieghere
Date: 2026-02-16T14:10:32-08:00
New Revision: 7c2109f02a0b30b900a1b5a91ad8d8758f75e33b
URL: https://github.com/llvm/llvm-project/commit/7c2109f02a0b30b900a1b5a91ad8d8758f75e33b
DIFF: https://github.com/llvm/llvm-project/commit/7c2109f02a0b30b900a1b5a91ad8d8758f75e33b.diff
LOG: [lldb] Fix compile error when tree-sitter is enabled
Not sure how this slipped in, I must have messed up something with the
stacked pull requests.
Added:
Modified:
lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.cpp
lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.cpp b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.cpp
index b73616f733e57..caf2c89c10eb8 100644
--- a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.cpp
+++ b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.cpp
@@ -89,7 +89,7 @@ TreeSitterHighlighter::GetStyleForCapture(llvm::StringRef capture_name,
void TreeSitterHighlighter::HighlightRange(
const HighlightStyle &options, llvm::StringRef text, uint32_t start_byte,
- uint32_t end_byte, const HighlightStyle::ColorStyle *style,
+ uint32_t end_byte, const HighlightStyle::ColorStyle &style,
std::optional<size_t> cursor_pos, bool &highlighted_cursor,
Stream &s) const {
@@ -102,7 +102,7 @@ void TreeSitterHighlighter::HighlightRange(
auto print = [&](llvm::StringRef str) {
if (style)
- style->Apply(s, str);
+ style.Apply(s, str);
else
s << str;
};
@@ -126,7 +126,7 @@ void TreeSitterHighlighter::HighlightRange(
StreamString cursor_str;
llvm::StringRef cursor_char = range.substr(cursor_in_range, 1);
if (style)
- style->Apply(cursor_str, cursor_char);
+ style.Apply(cursor_str, cursor_char);
else
cursor_str << cursor_char;
options.selected.Apply(s, cursor_str.GetString());
@@ -212,8 +212,8 @@ void TreeSitterHighlighter::Highlight(const HighlightStyle &options,
// Output any unhighlighted text before this highlight.
if (current_pos < h.start_byte) {
- HighlightRange(options, line, current_pos, h.start_byte, nullptr,
- cursor_pos, highlighted_cursor, s);
+ HighlightRange(options, line, current_pos, h.start_byte, {}, cursor_pos,
+ highlighted_cursor, s);
current_pos = h.start_byte;
}
@@ -226,7 +226,7 @@ void TreeSitterHighlighter::Highlight(const HighlightStyle &options,
// Output any remaining unhighlighted text.
if (current_pos < line.size()) {
HighlightRange(options, line, current_pos,
- static_cast<uint32_t>(line.size()), nullptr, cursor_pos,
+ static_cast<uint32_t>(line.size()), {}, cursor_pos,
highlighted_cursor, s);
}
}
diff --git a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
index 042824df166ab..ccc6a6bb69ca8 100644
--- a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
+++ b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
@@ -46,14 +46,14 @@ class TreeSitterHighlighter : public Highlighter {
/// Applies syntax highlighting to a range of text.
void HighlightRange(const HighlightStyle &options, llvm::StringRef text,
uint32_t start_byte, uint32_t end_byte,
- const HighlightStyle::ColorStyle *style,
+ const HighlightStyle::ColorStyle &style,
std::optional<size_t> cursor_pos,
bool &highlighted_cursor, Stream &s) const;
struct HLRange {
uint32_t start_byte;
uint32_t end_byte;
- const HighlightStyle::ColorStyle *style;
+ HighlightStyle::ColorStyle style;
};
struct TSState {
More information about the lldb-commits
mailing list