From 8b57dcf829ddb3940d9703edc0a071c1c99f768e Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 6 Jul 2016 01:27:33 +0000 Subject: Allows "experimental" settings that will either route to their containing settings or raise no error if not found. From time to time it is useful to add some setting to work around or enable a transitory feature. We've been reluctant to remove them later because then we will break folks .lldbinit files. With this change you can add an "experimental" node to the settings. If you later decide you want to keep the option, just move it to the level that contained the "experimental" setting and it will still be found. Or just remove it - setting it will then silently fail and won't halt the .lldbinit file execution. llvm-svn: 274593 --- lldb/source/Core/UserSettingsController.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lldb/source/Core/UserSettingsController.cpp') diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 837ff18721e..718c12d21a6 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -108,3 +108,27 @@ Properties::GetSubProperty (const ExecutionContext *exe_ctx, return lldb::OptionValuePropertiesSP(); } +const char * +Properties::GetExperimentalSettingsName() +{ + return "experimental"; +} + +bool +Properties::IsSettingExperimental(const char *setting) +{ + if (setting == nullptr) + return false; + + const char *experimental = GetExperimentalSettingsName(); + char *dot_pos = strchr(setting, '.'); + if (dot_pos == nullptr) + return strcmp(experimental, setting) == 0; + else + { + size_t first_elem_len = dot_pos - setting; + return strncmp(experimental, setting, first_elem_len) == 0; + } + +} + -- cgit v1.2.3