[PATCH] D115425: [clangd] Generate ConfigFragment/YAML/docs from one tablegen source

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 10:08:12 PST 2022


sammccall added a comment.

In D115425#3222782 <https://reviews.llvm.org/D115425#3222782>, @njames93 wrote:

> For the website, we use tags to specify the clangd version that the option was first supported in.
> I'd suggest that we also add a `Version` field to the `Field` class.
> This could also cause problem down the line if we ever wanted to remove a config option.

I definitely agree.
FWIW, I didn't send this for review because I wasn't sure about the idea.

Talked to @kadircet offline a bit, and I hope he doesn't mind me trying to summarize...

- avoiding a couple of duplicated parts is definitely good
- there's still config.h and the mapping thereto, which I don't think can be tablegenerated
- tablegen syntax is really bad and also hard to browse with the code (I agree)
- I don't see a better representation within the tablegen language (which is dumb, because this is a simple tree, but tablegen isn't good at trees)
- We couldn't think of a representation that would be *nice* to edit/maintain that's easy to have in-tree (apart from the current C++ structs, but parsing C++ at build time is terrible)

Actually we didn't discuss the option of using YAML itself as the format.
The downsides I can think of (vs current C++):

- no type system/checking/assistance for our weird DSL (tablegen a bit)
- have to use strings as comments rather than using comments as comments (though at least YAML has nice strings for this purpose)
- YAML is a pretty quirky language
- the inherent level-confusion of using YAML to describe a YAML schema

Maybe I'll mock this up, but I have some more pressing things to do so if anyone wants to shoot the idea first that'd be nice :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115425/new/

https://reviews.llvm.org/D115425



More information about the cfe-commits mailing list