[Lldb-commits] [lldb] [lldb] Fix building with Tree-sitter on Linux (PR #231535)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 13 07:54:22 PDT 2026
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/231535
I tried building with a locally built tree-sitter, manually passing TreeSitter_<...>_DIR. To get that to work I had to fix two things.
1. The lldb libraries need to build with the tree-sitter header paths included.
2. For whatever reason, clang 20 doesn't deem TSState to be default constructible with "= default" but it does with "{}". It must be default constructible for the later m_ts_state.emplace() calls to work.
>From ada6de85408cc6ee2e7ac15d96c2d1c36dd64604 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Tue, 13 Oct 2026 14:45:18 +0000
Subject: [PATCH] [lldb] Fix building with Tree-sitter on Linux
I tried building with a locally built tree-sitter, manually
passing TreeSitter_<...>_DIR. To get that to work I had to
fix two things.
1. The lldb libraries need to build with the tree-sitter header
paths included.
2. For whatever reason, clang 20 doesn't deem TSState to be
default constructible with "= default" but it does with
"{}". It must be default constructible for the later
m_ts_state.emplace() calls to work.
---
lldb/source/Plugins/Highlighter/TreeSitter/CMakeLists.txt | 4 ++++
.../Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Highlighter/TreeSitter/CMakeLists.txt b/lldb/source/Plugins/Highlighter/TreeSitter/CMakeLists.txt
index d36e888d585463..1ba4825303006d 100644
--- a/lldb/source/Plugins/Highlighter/TreeSitter/CMakeLists.txt
+++ b/lldb/source/Plugins/Highlighter/TreeSitter/CMakeLists.txt
@@ -9,6 +9,10 @@ add_lldb_library(lldbTreeSitter
${TreeSitter_LIBRARY}
)
+target_include_directories(lldbTreeSitter PUBLIC
+ ${TreeSitter_INCLUDE_DIR}
+)
+
function(add_tree_sitter_grammar name source_dir binary_dir)
set(TreeSitter_SOURCE_DIR ${source_dir}/${name})
set(TreeSitter_BINARY_DIR ${binary_dir}/src)
diff --git a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
index ccc6a6bb69ca8d..c4ad0857cb7ad0 100644
--- a/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
+++ b/lldb/source/Plugins/Highlighter/TreeSitter/TreeSitterHighlighter.h
@@ -57,7 +57,7 @@ class TreeSitterHighlighter : public Highlighter {
};
struct TSState {
- TSState() = default;
+ TSState() {};
TSState &operator=(const TSState &) = delete;
TSState(const TSState &) = delete;
~TSState();
More information about the lldb-commits
mailing list