@@ -168,7 +168,6 @@ lldb::addr_t OptionArgParser::ToAddress(const ExecutionContext *exe_ctx,
168
168
std::optional<lldb::addr_t >
169
169
OptionArgParser::DoToAddress (const ExecutionContext *exe_ctx, llvm::StringRef s,
170
170
Status *error_ptr) {
171
- bool error_set = false ;
172
171
if (s.empty ()) {
173
172
if (error_ptr)
174
173
error_ptr->SetErrorStringWithFormat (" invalid address expression \" %s\" " ,
@@ -212,6 +211,7 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
212
211
target->EvaluateExpression (s, exe_ctx->GetFramePtr (), valobj_sp, options);
213
212
214
213
bool success = false ;
214
+ bool error_set = false ;
215
215
if (expr_result == eExpressionCompleted) {
216
216
if (valobj_sp)
217
217
valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable (
@@ -223,16 +223,14 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
223
223
if (error_ptr)
224
224
error_ptr->Clear ();
225
225
return addr;
226
- } else {
227
- if (error_ptr) {
228
- error_set = true ;
229
- error_ptr->SetErrorStringWithFormat (
230
- " address expression \" %s\" resulted in a value whose type "
231
- " can't be converted to an address: %s" ,
232
- s.str ().c_str (), valobj_sp->GetTypeName ().GetCString ());
233
- }
234
226
}
235
-
227
+ if (error_ptr) {
228
+ error_set = true ;
229
+ error_ptr->SetErrorStringWithFormat (
230
+ " address expression \" %s\" resulted in a value whose type "
231
+ " can't be converted to an address: %s" ,
232
+ s.str ().c_str (), valobj_sp->GetTypeName ().GetCString ());
233
+ }
236
234
} else {
237
235
// Since the compiler can't handle things like "main + 12" we should try to
238
236
// do this for now. The compiler doesn't like adding offsets to function
@@ -252,8 +250,7 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
252
250
if (addr != LLDB_INVALID_ADDRESS) {
253
251
if (sign[0 ] == ' +' )
254
252
return addr + offset;
255
- else
256
- return addr - offset;
253
+ return addr - offset;
257
254
}
258
255
}
259
256
}
0 commit comments