[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
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index ba78469..92e8526 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -63,10 +63,8 @@
namespace {
-static constexpr PropertyDefinition g_properties[] = {
#define LLDB_PROPERTIES_platform
#include "Properties.inc"
-};
enum {
#define LLDB_PROPERTIES_platform
@@ -82,7 +80,7 @@
PlatformProperties::PlatformProperties() {
m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
- m_collection_sp->Initialize(g_properties);
+ m_collection_sp->Initialize(g_platform_properties);
auto module_cache_dir = GetModuleCacheDirectory();
if (module_cache_dir)
@@ -101,7 +99,7 @@
bool PlatformProperties::GetUseModuleCache() const {
const auto idx = ePropertyUseModuleCache;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_platform_properties[idx].default_uint_value != 0);
}
bool PlatformProperties::SetUseModuleCache(bool use_module_cache) {
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index aae5f65..f0cab63 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -112,10 +112,8 @@
}
};
-static constexpr PropertyDefinition g_properties[] = {
#define LLDB_PROPERTIES_process
#include "Properties.inc"
-};
enum {
#define LLDB_PROPERTIES_process
@@ -130,7 +128,7 @@
// Global process properties, set them up one time
m_collection_sp =
std::make_shared<ProcessOptionValueProperties>(ConstString("process"));
- m_collection_sp->Initialize(g_properties);
+ m_collection_sp->Initialize(g_process_properties);
m_collection_sp->AppendProperty(
ConstString("thread"), ConstString("Settings specific to threads."),
true, Thread::GetGlobalProperties()->GetValueProperties());
@@ -155,13 +153,13 @@
bool ProcessProperties::GetDisableMemoryCache() const {
const uint32_t idx = ePropertyDisableMemCache;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
uint64_t ProcessProperties::GetMemoryCacheLineSize() const {
const uint32_t idx = ePropertyMemCacheLineSize;
return m_collection_sp->GetPropertyAtIndexAsUInt64(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_process_properties[idx].default_uint_value);
}
Args ProcessProperties::GetExtraStartupCommands() const {
@@ -189,7 +187,7 @@
bool ProcessProperties::GetIgnoreBreakpointsInExpressions() const {
const uint32_t idx = ePropertyIgnoreBreakpointsInExpressions;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
void ProcessProperties::SetIgnoreBreakpointsInExpressions(bool ignore) {
@@ -200,7 +198,7 @@
bool ProcessProperties::GetUnwindOnErrorInExpressions() const {
const uint32_t idx = ePropertyUnwindOnErrorInExpressions;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
void ProcessProperties::SetUnwindOnErrorInExpressions(bool ignore) {
@@ -211,7 +209,7 @@
bool ProcessProperties::GetStopOnSharedLibraryEvents() const {
const uint32_t idx = ePropertyStopOnSharedLibraryEvents;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
void ProcessProperties::SetStopOnSharedLibraryEvents(bool stop) {
@@ -222,7 +220,7 @@
bool ProcessProperties::GetDetachKeepsStopped() const {
const uint32_t idx = ePropertyDetachKeepsStopped;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
void ProcessProperties::SetDetachKeepsStopped(bool stop) {
@@ -233,19 +231,19 @@
bool ProcessProperties::GetWarningsOptimization() const {
const uint32_t idx = ePropertyWarningOptimization;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
bool ProcessProperties::GetStopOnExec() const {
const uint32_t idx = ePropertyStopOnExec;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}
std::chrono::seconds ProcessProperties::GetUtilityExpressionTimeout() const {
const uint32_t idx = ePropertyUtilityExpressionTimeout;
uint64_t value = m_collection_sp->GetPropertyAtIndexAsUInt64(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_process_properties[idx].default_uint_value);
return std::chrono::seconds(value);
}
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index f1021af..abf9a08 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3273,10 +3273,8 @@
"Load complete information when loading modules from memory. Currently "
"this setting loads sections and all symbols."} };
-static constexpr PropertyDefinition g_properties[] = {
#define LLDB_PROPERTIES_target
#include "Properties.inc"
-};
enum {
#define LLDB_PROPERTIES_target
@@ -3328,7 +3326,7 @@
m_got_host_env = true;
const uint32_t idx = ePropertyInheritEnv;
if (GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0)) {
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0)) {
PlatformSP platform_sp(m_target->GetPlatform());
if (platform_sp) {
Environment env = platform_sp->GetEnvironment();
@@ -3356,10 +3354,8 @@
};
// TargetProperties
-static constexpr PropertyDefinition g_experimental_properties[]{
#define LLDB_PROPERTIES_experimental
#include "Properties.inc"
-};
enum {
#define LLDB_PROPERTIES_experimental
@@ -3434,7 +3430,7 @@
} else {
m_collection_sp =
std::make_shared<TargetOptionValueProperties>(ConstString("target"));
- m_collection_sp->Initialize(g_properties);
+ m_collection_sp->Initialize(g_target_properties);
m_experimental_properties_up.reset(new TargetExperimentalProperties());
m_collection_sp->AppendProperty(
ConstString(Properties::GetExperimentalSettingsName()),
@@ -3503,14 +3499,14 @@
bool TargetProperties::GetMoveToNearestCode() const {
const uint32_t idx = ePropertyMoveToNearestCode;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
lldb::DynamicValueType TargetProperties::GetPreferDynamicValue() const {
const uint32_t idx = ePropertyPreferDynamic;
return (lldb::DynamicValueType)
m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
bool TargetProperties::SetPreferDynamicValue(lldb::DynamicValueType d) {
@@ -3521,7 +3517,7 @@
bool TargetProperties::GetPreloadSymbols() const {
const uint32_t idx = ePropertyPreloadSymbols;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
void TargetProperties::SetPreloadSymbols(bool b) {
@@ -3532,7 +3528,7 @@
bool TargetProperties::GetDisableASLR() const {
const uint32_t idx = ePropertyDisableASLR;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
void TargetProperties::SetDisableASLR(bool b) {
@@ -3543,7 +3539,7 @@
bool TargetProperties::GetDetachOnError() const {
const uint32_t idx = ePropertyDetachOnError;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
void TargetProperties::SetDetachOnError(bool b) {
@@ -3554,7 +3550,7 @@
bool TargetProperties::GetDisableSTDIO() const {
const uint32_t idx = ePropertyDisableSTDIO;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
void TargetProperties::SetDisableSTDIO(bool b) {
@@ -3568,7 +3564,7 @@
x86DisassemblyFlavor flavor_value =
(x86DisassemblyFlavor)m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
return_value = g_x86_dis_flavor_value_types[flavor_value].string_value;
return return_value;
}
@@ -3576,7 +3572,7 @@
InlineStrategy TargetProperties::GetInlineStrategy() const {
const uint32_t idx = ePropertyInlineStrategy;
return (InlineStrategy)m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
llvm::StringRef TargetProperties::GetArg0() const {
@@ -3620,7 +3616,7 @@
bool TargetProperties::GetSkipPrologue() const {
const uint32_t idx = ePropertySkipPrologue;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
PathMappingList &TargetProperties::GetSourcePathMap() const {
@@ -3671,55 +3667,55 @@
bool TargetProperties::GetEnableAutoImportClangModules() const {
const uint32_t idx = ePropertyAutoImportClangModules;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetEnableImportStdModule() const {
const uint32_t idx = ePropertyImportStdModule;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetEnableAutoApplyFixIts() const {
const uint32_t idx = ePropertyAutoApplyFixIts;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetEnableNotifyAboutFixIts() const {
const uint32_t idx = ePropertyNotifyAboutFixIts;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetEnableSaveObjects() const {
const uint32_t idx = ePropertySaveObjects;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetEnableSyntheticValue() const {
const uint32_t idx = ePropertyEnableSynthetic;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
uint32_t TargetProperties::GetMaximumNumberOfChildrenToDisplay() const {
const uint32_t idx = ePropertyMaxChildrenCount;
return m_collection_sp->GetPropertyAtIndexAsSInt64(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
uint32_t TargetProperties::GetMaximumSizeOfStringSummary() const {
const uint32_t idx = ePropertyMaxSummaryLength;
return m_collection_sp->GetPropertyAtIndexAsSInt64(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
uint32_t TargetProperties::GetMaximumMemReadSize() const {
const uint32_t idx = ePropertyMaxMemReadSize;
return m_collection_sp->GetPropertyAtIndexAsSInt64(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
FileSpec TargetProperties::GetStandardInputPath() const {
@@ -3779,52 +3775,52 @@
bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() {
const uint32_t idx = ePropertyBreakpointUseAvoidList;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetUseHexImmediates() const {
const uint32_t idx = ePropertyUseHexImmediates;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetUseFastStepping() const {
const uint32_t idx = ePropertyUseFastStepping;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
bool TargetProperties::GetDisplayExpressionsInCrashlogs() const {
const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
LoadScriptFromSymFile TargetProperties::GetLoadScriptFromSymbolFile() const {
const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
return (LoadScriptFromSymFile)
m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
LoadCWDlldbinitFile TargetProperties::GetLoadCWDlldbinitFile() const {
const uint32_t idx = ePropertyLoadCWDlldbinitFile;
return (LoadCWDlldbinitFile)m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
Disassembler::HexImmediateStyle TargetProperties::GetHexImmediateStyle() const {
const uint32_t idx = ePropertyHexImmediateStyle;
return (Disassembler::HexImmediateStyle)
m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
MemoryModuleLoadLevel TargetProperties::GetMemoryModuleLoadLevel() const {
const uint32_t idx = ePropertyMemoryModuleLoadLevel;
return (MemoryModuleLoadLevel)
m_collection_sp->GetPropertyAtIndexAsEnumeration(
- nullptr, idx, g_properties[idx].default_uint_value);
+ nullptr, idx, g_target_properties[idx].default_uint_value);
}
bool TargetProperties::GetUserSpecifiedTrapHandlerNames(Args &args) const {
@@ -3901,7 +3897,7 @@
bool TargetProperties::GetRequireHardwareBreakpoints() const {
const uint32_t idx = ePropertyRequireHardwareBreakpoints;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
void TargetProperties::SetRequireHardwareBreakpoints(bool b) {
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index f436730..78cddfe 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -63,10 +63,8 @@
return *g_settings_sp_ptr;
}
-static constexpr PropertyDefinition g_properties[] = {
#define LLDB_PROPERTIES_thread
#include "Properties.inc"
-};
enum {
#define LLDB_PROPERTIES_thread
@@ -108,7 +106,7 @@
if (is_global) {
m_collection_sp =
std::make_shared<ThreadOptionValueProperties>(ConstString("thread"));
- m_collection_sp->Initialize(g_properties);
+ m_collection_sp->Initialize(g_thread_properties);
} else
m_collection_sp = std::make_shared<ThreadOptionValueProperties>(
Thread::GetGlobalProperties().get());
@@ -133,25 +131,25 @@
bool ThreadProperties::GetTraceEnabledState() const {
const uint32_t idx = ePropertyEnableThreadTrace;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
}
bool ThreadProperties::GetStepInAvoidsNoDebug() const {
const uint32_t idx = ePropertyStepInAvoidsNoDebug;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
}
bool ThreadProperties::GetStepOutAvoidsNoDebug() const {
const uint32_t idx = ePropertyStepOutAvoidsNoDebug;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
}
uint64_t ThreadProperties::GetMaxBacktraceDepth() const {
const uint32_t idx = ePropertyMaxBacktraceDepth;
return m_collection_sp->GetPropertyAtIndexAsUInt64(
- nullptr, idx, g_properties[idx].default_uint_value != 0);
+ nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
}
// Thread Event Data