[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 30 08:44:41 PDT 2024


adrian-prantl wrote:

> Why does this use tablegen to parse a .def file?
> 
> Can't you get the same behavior without tablegen, using normal xmacro techniques, something like
> 
> ```c++
> enum SBSourceLanguageName : uint16_t {
> 
> #define HANDLE_DW_LNAME(ID, NAME, DESC, LOWER_BOUND) \
>   eLanguageName ## NAME = ID,
> 
> #include "llvm/include/llvm/BinaryFormat/Dwarf.def"
> 
> #undef HANDLE_DW_LNAME
> 
> };
> ```
> 
> ? Why bring tablegen into this?
> 
> (Sorry if I'm missing something obvious.)

That's a very valid question to ask!
The reason is that the header files produced here are part of the LLDB scripting API and are going to be processed by tools that are not full compilers and fully expanding this at compile-time avoids any compatibility issues with not fully compliant interface generators. The reason why this is implemented in C++ is because I don't want to assume that there is `sed` or something equivalent available on the build system especially on platforms like Windows.

https://github.com/llvm/llvm-project/pull/89981


More information about the lldb-commits mailing list