From 4e991b44efa22dee8cff5c46817b84198ca87bbb Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Sun, 2 Mar 2025 08:45:51 -0800 Subject: [PATCH 1/4] Add BuiltinHeaders to config docs --- config.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config.md b/config.md index 1cd5437..24438b8 100644 --- a/config.md +++ b/config.md @@ -147,6 +147,23 @@ flag parsing (clang vs clang-cl), target inference (gcc-arm-noneabi) etc. If the option matches a glob mentioned in `--query-driver`, then it'll be invoked for extraction of include paths. +### BuiltinHeaders +{:.v21} + +Controls whether Clangd should includes its own built-in headers (like stddef.h), or use the system header found from the query driver. + +Valid values are: +- `Clangd`: Use builtin headers from `clangd`. +- `QueryDriver`: Use the headers extracted from the compiler via the + `--query-driver` command line argument. If a query driver is not supplied or + does not match the compiler, then the `Clangd` builtin headers will be the + fallback. + +```yaml +CompileFlags: + BuiltinHeaders: QueryDriver +``` + ## Index Controls how clangd understands code outside the current file. From 5a305ad2c428e9d76718fd1023268a6c42dce3be Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Sat, 8 Mar 2025 08:10:40 -0800 Subject: [PATCH 2/4] Add CSS for v21 & note to config key --- config.md | 9 +++++++-- styles.css | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config.md b/config.md index 24438b8..2e71999 100644 --- a/config.md +++ b/config.md @@ -150,10 +150,11 @@ invoked for extraction of include paths. ### BuiltinHeaders {:.v21} -Controls whether Clangd should includes its own built-in headers (like stddef.h), or use the system header found from the query driver. +Controls whether Clangd should include its own built-in headers (like +stddef.h), or use the system header found from the query driver. Valid values are: -- `Clangd`: Use builtin headers from `clangd`. +- `Clangd`: Use builtin headers from `clangd`. This is the default. - `QueryDriver`: Use the headers extracted from the compiler via the `--query-driver` command line argument. If a query driver is not supplied or does not match the compiler, then the `Clangd` builtin headers will be the @@ -164,6 +165,10 @@ CompileFlags: BuiltinHeaders: QueryDriver ``` +Note that if the driver is not clang, this will result in the clang frontend +(embedded in clangd) processing the builtin headers of another compiler, which +could lead to unexpected results such as false positive diagnostics. + ## Index Controls how clangd understands code outside the current file. diff --git a/styles.css b/styles.css index 721cf2c..2f34123 100644 --- a/styles.css +++ b/styles.css @@ -170,7 +170,7 @@ a[href^="https://code.woboq.org/"] { /* Version marker ornaments */ .v6::before, .v7::before, .v8::before, .v9::before, .v10::before, .v11::before, .v12::before, .v13::before, .v14::before, .v15::before, .v16::before, .v17::before, .v18::before, .v19::before, -.v20::before { +.v20::before .v21::before { color: #008; border-radius: 3px; padding: 0.2em 0.6em; @@ -197,6 +197,7 @@ a[href^="https://code.woboq.org/"] { .v18::before { content: "clangd-18"; } .v19::before { content: "clangd-19"; } .v20::before { content: "clangd-20"; } +.v21::before { content: "clangd-21"; } #edit { text-decoration: none; position: absolute; From a50e6775c38b8669387bed87594679972f8f76de Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sat, 8 Mar 2025 19:18:49 -0500 Subject: [PATCH 3/4] Fix CSS syntax --- styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles.css b/styles.css index 2f34123..f47ffbd 100644 --- a/styles.css +++ b/styles.css @@ -170,7 +170,7 @@ a[href^="https://code.woboq.org/"] { /* Version marker ornaments */ .v6::before, .v7::before, .v8::before, .v9::before, .v10::before, .v11::before, .v12::before, .v13::before, .v14::before, .v15::before, .v16::before, .v17::before, .v18::before, .v19::before, -.v20::before .v21::before { +.v20::before, .v21::before { color: #008; border-radius: 3px; padding: 0.2em 0.6em; From bff76bf7934898eb0c64e80559326c8d5888de4a Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sat, 8 Mar 2025 19:22:16 -0500 Subject: [PATCH 4/4] Clarify cautionary note about `BuiltinHeader: QueryDriver` --- config.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config.md b/config.md index 2e71999..8065401 100644 --- a/config.md +++ b/config.md @@ -165,9 +165,10 @@ CompileFlags: BuiltinHeaders: QueryDriver ``` -Note that if the driver is not clang, this will result in the clang frontend -(embedded in clangd) processing the builtin headers of another compiler, which -could lead to unexpected results such as false positive diagnostics. +**Note**: if the driver is not clang, `BuiltinHeaders: QueryDriver` will result +in the clang frontend (embedded in clangd) processing the builtin headers of +another compiler, which could lead to unexpected results such as false positive +diagnostics. ## Index