Commit Graph

7 Commits

Author SHA1 Message Date
Jonas Devlieghere 10b5cd8ed5 [LLDB] Fix inline variable only used in assertion. (NFC)
This prevents unused variable warning/error in -DNDEBUG builds. The
variable was introduced in 5934cd11ea.

Patch by: Shu-Chun Weng

Differential revision: https://reviews.llvm.org/D69451
2019-10-25 15:47:17 -07:00
Jonas Devlieghere 5934cd11ea [TableGen] Add asserts to make sure default values match property type
This adds a few asserts to the property TableGen backend to prevent
mismatches between property types and their default values. This
would've prevented a copy-paste mistake we discovered downstream.
2019-10-25 10:18:38 -07:00
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