From 63b01a61becff16af5ace07988c28d43a1920107 Mon Sep 17 00:00:00 2001
From: Jeroen Dhollander <jeroendh@google.com>
Date: Tue, 30 Apr 2024 17:19:43 +0000
Subject: [PATCH] Tell clangd to ignore -DUNSAFE_BUFFERS_BUILD flag

This compiler flag was added in https://crrev.com/c/5485646
and it causes the code to add lines declaring the pragma
`allow_unsafe_buffers` which clangd does not know.
This causes clangd to throw hundreds of `Unknown pragma ignored` errors
after which clangd just gives up on indexing.

Bug: 40284755
Test: Generate compile_commands.json with and without this fix and observe the errors when opening files in my editor.
Change-Id: I712dd2a2fa981e275229b68f5db15449d44f10fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5498358
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: Jeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/main@{#1294438}
---
 .clangd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clangd b/.clangd
index f91aecc529231..a9cf1b1100ecc 100644
--- a/.clangd
+++ b/.clangd
@@ -4,4 +4,4 @@ Diagnostics:
   UnusedIncludes: None
   MissingIncludes: None
 CompileFlags:
-  Remove: [-cfg=*, -exec_root=*, -inputs=*]
+  Remove: [-cfg=*, -exec_root=*, -inputs=*, -DUNSAFE_BUFFERS_BUILD]