Commit Graph

5 Commits

Author SHA1 Message Date
Jonas Devlieghere be019c7a1f [TableGen] Move helpers into LLDBTableGenUtils.
Instead of polluting the LLDBTableGenBackends header with helpers used
by both emitters, move them into a separate files.

llvm-svn: 367377
2019-07-31 00:47:00 +00:00
Jonas Devlieghere 310f6b89b1 [TableGen] Reuse typedef across emitters (NFC)
This moves the std::map typedef into the header so it can be reused by
all the emitter implementations.

llvm-svn: 367363
2019-07-30 22:50:37 +00:00
Jonas Devlieghere a8ea595509 [lldb] Also include the array definition in Properties.inc
Right now our Properties.inc only generates the initializer for the
options list but not the array declaration boilerplate around it. As the
array definition is identical for all arrays, we might as well also let
the Properties.inc generate it alongside the initializers.

Unfortunately we cannot do the same for enums, as there's this magic
ePropertyExperimental, which needs to come at the end to be interpreted
correctly. Hopefully we can get rid of this in the future and do the
same for the property enums.

Differential revision: https://reviews.llvm.org/D65353

llvm-svn: 367238
2019-07-29 16:41:30 +00:00
Jonas Devlieghere 7296fac558 [Tablegen] Fix issues caused by incorrect escaping.
The printEscapedString would escape newlines by their ASCII values
instead of prefixing them with a `\`. Remove the escaping logic and
escape the strings in the definition file.

llvm-svn: 367065
2019-07-25 22:17:08 +00:00
Jonas Devlieghere 971f9ca612 Let tablegen generate property definitions
Property definitions are currently defined in a PropertyDefinition array
and have a corresponding enum to index in this array. Unfortunately this
is quite error prone. Indeed, just today we found an incorrect merge
where a discrepancy between the order of the enum values and their
definition caused the test suite to fail spectacularly.

Tablegen can streamline the process of generating the property
definition table while at the same time guaranteeing that the enums stay
in sync. That's exactly what this patch does. It adds a new tablegen
file for the properties, building on top of the infrastructure that
Raphael added recently for the command options. It also introduces two
new tablegen backends: one for the property definitions and one for
their corresponding enums.

It might be worth mentioning that I generated most of the tablegen
definitions from the existing property definitions, by adding a dump
method to the struct. This seems both more efficient and less error
prone that copying everything over by hand. Only Enum properties needed
manual fixup for the EnumValues and DefaultEnumValue fields.

Differential revision: https://reviews.llvm.org/D65185

llvm-svn: 367058
2019-07-25 21:36:37 +00:00