Author: zturner Date: Sat Nov 12 21:29:46 2016 New Revision: 286744 URL: http://llvm.org/viewvc/llvm-project?rev=286744&view=rev Log: Change ValueObject creation functions to take StringRefs.
Modified: lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/DataFormatters/TypeSynthetic.cpp lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=286744&r1=286743&r2=286744&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Sat Nov 12 21:29:46 2016 @@ -650,21 +650,23 @@ public: void Dump(Stream &s, const DumpValueObjectOptions &options); static lldb::ValueObjectSP - CreateValueObjectFromExpression(const char *name, const char *expression, + CreateValueObjectFromExpression(llvm::StringRef name, + llvm::StringRef expression, const ExecutionContext &exe_ctx); static lldb::ValueObjectSP - CreateValueObjectFromExpression(const char *name, const char *expression, + CreateValueObjectFromExpression(llvm::StringRef name, + llvm::StringRef expression, const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options); static lldb::ValueObjectSP - CreateValueObjectFromAddress(const char *name, uint64_t address, + CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type); static lldb::ValueObjectSP - CreateValueObjectFromData(const char *name, const DataExtractor &data, + CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type); void LogValueObject(Log *log); Modified: lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h?rev=286744&r1=286743&r2=286744&view=diff ============================================================================== --- lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h (original) +++ lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h Sat Nov 12 21:29:46 2016 @@ -90,15 +90,16 @@ public: protected: lldb::ValueObjectSP - CreateValueObjectFromExpression(const char *name, const char *expression, + CreateValueObjectFromExpression(llvm::StringRef name, + llvm::StringRef expression, const ExecutionContext &exe_ctx); lldb::ValueObjectSP - CreateValueObjectFromAddress(const char *name, uint64_t address, + CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type); - lldb::ValueObjectSP CreateValueObjectFromData(const char *name, + lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type); Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=286744&r1=286743&r2=286744&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Sat Nov 12 21:29:46 2016 @@ -3605,32 +3605,33 @@ SymbolContextScope *ValueObject::GetSymb return NULL; } -lldb::ValueObjectSP ValueObject::CreateValueObjectFromExpression( - const char *name, const char *expression, const ExecutionContext &exe_ctx) { +lldb::ValueObjectSP +ValueObject::CreateValueObjectFromExpression(llvm::StringRef name, + llvm::StringRef expression, + const ExecutionContext &exe_ctx) { return CreateValueObjectFromExpression(name, expression, exe_ctx, EvaluateExpressionOptions()); } lldb::ValueObjectSP ValueObject::CreateValueObjectFromExpression( - const char *name, const char *expression, const ExecutionContext &exe_ctx, - const EvaluateExpressionOptions &options) { + llvm::StringRef name, llvm::StringRef expression, + const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options) { lldb::ValueObjectSP retval_sp; lldb::TargetSP target_sp(exe_ctx.GetTargetSP()); if (!target_sp) return retval_sp; - if (!expression || !*expression) + if (expression.empty()) return retval_sp; target_sp->EvaluateExpression(expression, exe_ctx.GetFrameSP().get(), retval_sp, options); - if (retval_sp && name && *name) + if (retval_sp && !name.empty()) retval_sp->SetName(ConstString(name)); return retval_sp; } -lldb::ValueObjectSP -ValueObject::CreateValueObjectFromAddress(const char *name, uint64_t address, - const ExecutionContext &exe_ctx, - CompilerType type) { +lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress( + llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, + CompilerType type) { if (type) { CompilerType pointer_type(type.GetPointerType()); if (pointer_type) { @@ -3645,7 +3646,7 @@ ValueObject::CreateValueObjectFromAddres Value::eValueTypeLoadAddress); Error err; ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err); - if (ptr_result_valobj_sp && name && *name) + if (ptr_result_valobj_sp && !name.empty()) ptr_result_valobj_sp->SetName(ConstString(name)); } return ptr_result_valobj_sp; @@ -3655,14 +3656,14 @@ ValueObject::CreateValueObjectFromAddres } lldb::ValueObjectSP ValueObject::CreateValueObjectFromData( - const char *name, const DataExtractor &data, + llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type) { lldb::ValueObjectSP new_value_sp; new_value_sp = ValueObjectConstResult::Create( exe_ctx.GetBestExecutionContextScope(), type, ConstString(name), data, LLDB_INVALID_ADDRESS); new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad); - if (new_value_sp && name && *name) + if (new_value_sp && !name.empty()) new_value_sp->SetName(ConstString(name)); return new_value_sp; } Modified: lldb/trunk/source/DataFormatters/TypeSynthetic.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSynthetic.cpp?rev=286744&r1=286743&r2=286744&view=diff ============================================================================== --- lldb/trunk/source/DataFormatters/TypeSynthetic.cpp (original) +++ lldb/trunk/source/DataFormatters/TypeSynthetic.cpp Sat Nov 12 21:29:46 2016 @@ -101,7 +101,8 @@ std::string CXXSyntheticChildren::GetDes } lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromExpression( - const char *name, const char *expression, const ExecutionContext &exe_ctx) { + llvm::StringRef name, llvm::StringRef expression, + const ExecutionContext &exe_ctx) { ValueObjectSP valobj_sp( ValueObject::CreateValueObjectFromExpression(name, expression, exe_ctx)); if (valobj_sp) @@ -110,7 +111,7 @@ lldb::ValueObjectSP SyntheticChildrenFro } lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromAddress( - const char *name, uint64_t address, const ExecutionContext &exe_ctx, + llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type) { ValueObjectSP valobj_sp( ValueObject::CreateValueObjectFromAddress(name, address, exe_ctx, type)); @@ -120,7 +121,7 @@ lldb::ValueObjectSP SyntheticChildrenFro } lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromData( - const char *name, const DataExtractor &data, + llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type) { ValueObjectSP valobj_sp( ValueObject::CreateValueObjectFromData(name, data, exe_ctx, type)); Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp?rev=286744&r1=286743&r2=286744&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp Sat Nov 12 21:29:46 2016 @@ -509,7 +509,8 @@ ValueObjectSP GoUserExpression::GoInterp DataExtractor data(buf, order, addr_size); CompilerType type = LookupType(target, ConstString("int64")); - return ValueObject::CreateValueObjectFromData(nullptr, data, m_exe_ctx, type); + return ValueObject::CreateValueObjectFromData(llvm::StringRef(), data, + m_exe_ctx, type); } ValueObjectSP GoUserExpression::GoInterpreter::VisitIndexExpr( @@ -565,7 +566,7 @@ GoUserExpression::GoInterpreter::VisitUn case GoLexer::OP_AMP: { CompilerType type = x->GetCompilerType().GetPointerType(); uint64_t address = x->GetAddressOf(); - return ValueObject::CreateValueObjectFromAddress(nullptr, address, + return ValueObject::CreateValueObjectFromAddress(llvm::StringRef(), address, m_exe_ctx, type); } case GoLexer::OP_PLUS: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits