diff options
Diffstat (limited to 'source/Interpreter/Property.cpp')
-rw-r--r-- | source/Interpreter/Property.cpp | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/source/Interpreter/Property.cpp b/source/Interpreter/Property.cpp index 4cabc3fd2..eafa7afc1 100644 --- a/source/Interpreter/Property.cpp +++ b/source/Interpreter/Property.cpp @@ -15,6 +15,8 @@ #include "lldb/Interpreter/OptionValues.h" #include "lldb/Target/Language.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -29,18 +31,20 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_uint_value" is not used // "definition.default_cstr_value" as a string value that represents the // default string value for the architecture/triple - m_value_sp.reset(new OptionValueArch(definition.default_cstr_value)); + m_value_sp = + std::make_shared<OptionValueArch>(definition.default_cstr_value); break; case OptionValue::eTypeArgs: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueArgs()); + m_value_sp = std::make_shared<OptionValueArgs>(); break; case OptionValue::eTypeArray: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueArray(OptionValue::ConvertTypeToMask( - (OptionValue::Type)definition.default_uint_value))); + m_value_sp = + std::make_shared<OptionValueArray>(OptionValue::ConvertTypeToMask( + (OptionValue::Type)definition.default_uint_value)); break; case OptionValue::eTypeBoolean: @@ -49,11 +53,12 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" as a string value that represents the // default value. if (definition.default_cstr_value) - m_value_sp.reset(new OptionValueBoolean(OptionArgParser::ToBoolean( - llvm::StringRef(definition.default_cstr_value), false, nullptr))); + m_value_sp = + std::make_shared<OptionValueBoolean>(OptionArgParser::ToBoolean( + llvm::StringRef(definition.default_cstr_value), false, nullptr)); else - m_value_sp.reset( - new OptionValueBoolean(definition.default_uint_value != 0)); + m_value_sp = std::make_shared<OptionValueBoolean>( + definition.default_uint_value != 0); break; case OptionValue::eTypeChar: { @@ -64,8 +69,9 @@ Property::Property(const PropertyDefinition &definition) } case OptionValue::eTypeDictionary: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueDictionary(OptionValue::ConvertTypeToMask( - (OptionValue::Type)definition.default_uint_value))); + m_value_sp = + std::make_shared<OptionValueDictionary>(OptionValue::ConvertTypeToMask( + (OptionValue::Type)definition.default_uint_value)); break; case OptionValue::eTypeEnum: @@ -100,14 +106,14 @@ Property::Property(const PropertyDefinition &definition) FileSpec file_spec = FileSpec(definition.default_cstr_value); if (resolve) FileSystem::Instance().Resolve(file_spec); - m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve)); + m_value_sp = std::make_shared<OptionValueFileSpec>(file_spec, resolve); break; } case OptionValue::eTypeFileSpecList: // "definition.default_uint_value" is not used for a // OptionValue::eTypeFileSpecList - m_value_sp.reset(new OptionValueFileSpecList()); + m_value_sp = std::make_shared<OptionValueFileSpecList>(); break; case OptionValue::eTypeFormat: @@ -122,7 +128,7 @@ Property::Property(const PropertyDefinition &definition) nullptr); else new_format = (Format)definition.default_uint_value; - m_value_sp.reset(new OptionValueFormat(new_format)); + m_value_sp = std::make_shared<OptionValueFormat>(new_format); } break; @@ -138,29 +144,30 @@ Property::Property(const PropertyDefinition &definition) llvm::StringRef(definition.default_cstr_value)); else new_lang = (LanguageType)definition.default_uint_value; - m_value_sp.reset(new OptionValueLanguage(new_lang)); + m_value_sp = std::make_shared<OptionValueLanguage>(new_lang); } break; case OptionValue::eTypeFormatEntity: // "definition.default_cstr_value" as a string value that represents the // default - m_value_sp.reset( - new OptionValueFormatEntity(definition.default_cstr_value)); + m_value_sp = std::make_shared<OptionValueFormatEntity>( + definition.default_cstr_value); break; case OptionValue::eTypePathMap: // "definition.default_uint_value" tells us if notifications should occur // for path mappings - m_value_sp.reset( - new OptionValuePathMappings(definition.default_uint_value != 0)); + m_value_sp = std::make_shared<OptionValuePathMappings>( + definition.default_uint_value != 0); break; case OptionValue::eTypeRegex: // "definition.default_uint_value" is used to the regular expression flags // "definition.default_cstr_value" the default regular expression value // value. - m_value_sp.reset(new OptionValueRegex(definition.default_cstr_value)); + m_value_sp = + std::make_shared<OptionValueRegex>(definition.default_cstr_value); break; case OptionValue::eTypeSInt64: @@ -168,10 +175,10 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the // default value. - m_value_sp.reset(new OptionValueSInt64( + m_value_sp = std::make_shared<OptionValueSInt64>( definition.default_cstr_value ? StringConvert::ToSInt64(definition.default_cstr_value) - : definition.default_uint_value)); + : definition.default_uint_value); break; case OptionValue::eTypeUInt64: @@ -179,10 +186,10 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the // default value. - m_value_sp.reset(new OptionValueUInt64( + m_value_sp = std::make_shared<OptionValueUInt64>( definition.default_cstr_value ? StringConvert::ToUInt64(definition.default_cstr_value) - : definition.default_uint_value)); + : definition.default_uint_value); break; case OptionValue::eTypeUUID: @@ -192,7 +199,7 @@ Property::Property(const PropertyDefinition &definition) UUID uuid; if (definition.default_cstr_value) uuid.SetFromStringRef(definition.default_cstr_value); - m_value_sp.reset(new OptionValueUUID(uuid)); + m_value_sp = std::make_shared<OptionValueUUID>(uuid); } break; |