diff options
| author | Zachary Turner <zturner@google.com> | 2016-11-13 03:29:46 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-11-13 03:29:46 +0000 |
| commit | aa5611f56df92ca78df874a3b751f906044460c1 (patch) | |
| tree | 2ea0cd20f0ff488617c617e0c8edc130304b79d6 /lldb/source | |
| parent | 7a120c8b3df60a5da382f8f7baeaccdfa928bd5b (diff) | |
| download | bcm5719-llvm-aa5611f56df92ca78df874a3b751f906044460c1.tar.gz bcm5719-llvm-aa5611f56df92ca78df874a3b751f906044460c1.zip | |
Change ValueObject creation functions to take StringRefs.
llvm-svn: 286744
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 27 | ||||
| -rw-r--r-- | lldb/source/DataFormatters/TypeSynthetic.cpp | 7 | ||||
| -rw-r--r-- | lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | 5 |
3 files changed, 21 insertions, 18 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index edd549059b2..cd6bc8998a2 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -3605,32 +3605,33 @@ SymbolContextScope *ValueObject::GetSymbolContextScope() { 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::CreateValueObjectFromAddress(const char *name, uint64_t address, 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::CreateValueObjectFromAddress(const char *name, uint64_t address, } 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; } diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp index 7bfc8794e5c..0f7bd9aa795 100644 --- a/lldb/source/DataFormatters/TypeSynthetic.cpp +++ b/lldb/source/DataFormatters/TypeSynthetic.cpp @@ -101,7 +101,8 @@ std::string CXXSyntheticChildren::GetDescription() { } 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 SyntheticChildrenFrontEnd::CreateValueObjectFromExpression( } 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 SyntheticChildrenFrontEnd::CreateValueObjectFromAddress( } 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)); diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 30cc4aa828e..a448da683e3 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -509,7 +509,8 @@ ValueObjectSP GoUserExpression::GoInterpreter::VisitBasicLit( 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::VisitUnaryExpr(const GoASTUnaryExpr *e) { 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: |

