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
This commit is contained in:
Jonas Devlieghere
2019-07-25 21:36:37 +00:00
parent d16a034c7c
commit 971f9ca612
38 changed files with 901 additions and 564 deletions

View File

@@ -64,30 +64,13 @@ const ThreadPropertiesSP &Thread::GetGlobalProperties() {
}
static constexpr PropertyDefinition g_properties[] = {
{"step-in-avoid-nodebug", OptionValue::eTypeBoolean, true, true, nullptr,
{},
"If true, step-in will not stop in functions with no debug information."},
{"step-out-avoid-nodebug", OptionValue::eTypeBoolean, true, false, nullptr,
{}, "If true, when step-in/step-out/step-over leave the current frame, "
"they will continue to step out till they come to a function with "
"debug information. Passing a frame argument to step-out will "
"override this option."},
{"step-avoid-regexp", OptionValue::eTypeRegex, true, 0, "^std::", {},
"A regular expression defining functions step-in won't stop in."},
{"step-avoid-libraries", OptionValue::eTypeFileSpecList, true, 0, nullptr,
{}, "A list of libraries that source stepping won't stop in."},
{"trace-thread", OptionValue::eTypeBoolean, false, false, nullptr, {},
"If true, this thread will single-step and log execution."},
{"max-backtrace-depth", OptionValue::eTypeUInt64, false, 300000, nullptr,
{}, "Maximum number of frames to backtrace."}};
#define LLDB_PROPERTIES_thread
#include "lldb/Core/Properties.inc"
};
enum {
ePropertyStepInAvoidsNoDebug,
ePropertyStepOutAvoidsNoDebug,
ePropertyStepAvoidRegex,
ePropertyStepAvoidLibraries,
ePropertyEnableThreadTrace,
ePropertyMaxBacktraceDepth
#define LLDB_PROPERTIES_thread
#include "lldb/Core/PropertiesEnum.inc"
};
class ThreadOptionValueProperties : public OptionValueProperties {