From 02bac03162280236ef7a33993358cb7dcff443d1 Mon Sep 17 00:00:00 2001 From: Florent Revest Date: Wed, 21 Jan 2026 15:38:10 +0100 Subject: tools/clang/json: escape strings properly When preparing a codesearch index, I encountered errors which I narrowed down to lines like the following in the json output of codesearch: "type": "void (void __attribute__((btf_type_tag("user")))*, const void *, size_t, size_t)", After this change, the line gets formatted like this: "type": "void (void __attribute__((btf_type_tag(\"user\")))*, const void *, size_t, size_t)", This fixes the errors I encountered --- pkg/codesearch/testdata/source0.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/codesearch/testdata/source0.c') diff --git a/pkg/codesearch/testdata/source0.c b/pkg/codesearch/testdata/source0.c index 5ac117cab..e5b47841b 100644 --- a/pkg/codesearch/testdata/source0.c +++ b/pkg/codesearch/testdata/source0.c @@ -31,3 +31,7 @@ int func_accepting_a_struct(struct some_struct* p) return ((some_struct_t*)p)->x + ((union some_union*)p)->x; } + +void function_with_quotes_in_type(void __attribute__((btf_type_tag("user"))) *) +{ +} -- cgit mrf-deployment