@@ -237,10 +237,10 @@ Interpreter::Visit(const IdentifierNode *node) {
237237llvm::Expected<lldb::ValueObjectSP>
238238Interpreter::Visit (const UnaryOpNode *node) {
239239 Status error;
240- auto rhs_or_err = Evaluate (node->rhs ());
241- if (!rhs_or_err) {
240+ auto rhs_or_err = Evaluate (node->operand ());
241+ if (!rhs_or_err)
242242 return rhs_or_err;
243- }
243+
244244 lldb::ValueObjectSP rhs = *rhs_or_err;
245245
246246 switch (node->kind ()) {
@@ -249,30 +249,26 @@ Interpreter::Visit(const UnaryOpNode *node) {
249249 if (dynamic_rhs)
250250 rhs = dynamic_rhs;
251251
252- CompilerType rhs_type = rhs->GetCompilerType ();
253- if (!rhs_type.IsReferenceType () && !rhs_type.IsPointerType ())
254- return llvm::make_error<DILDiagnosticError>(
255- m_expr, " not a pointer or reference type" ,
256- node->rhs ()->GetLocation ());
257-
258- if (rhs_type.IsPointerToVoid ()) {
252+ if (rhs->GetCompilerType ().IsPointerToVoid ()) {
259253 return llvm::make_error<DILDiagnosticError>(
260254 m_expr, " indirection not permitted on operand of type 'void *'" ,
261255 node->GetLocation ());
262256 }
257+
263258 lldb::ValueObjectSP child_sp = rhs->Dereference (error);
264- if (error.Success ())
265- rhs = child_sp;
259+ if (error.Fail ())
260+ return llvm::make_error<DILDiagnosticError>(m_expr, error.AsCString (),
261+ node->GetLocation ());
266262
267- return rhs ;
263+ return child_sp ;
268264 }
269265 case UnaryOpKind::AddrOf: {
270266 Status error;
271267 lldb::ValueObjectSP value = rhs->AddressOf (error);
272- if (error.Fail ()) {
268+ if (error.Fail ())
273269 return llvm::make_error<DILDiagnosticError>(m_expr, error.AsCString (),
274270 node->GetLocation ());
275- }
271+
276272 return value;
277273 }
278274 }
@@ -282,4 +278,4 @@ Interpreter::Visit(const UnaryOpNode *node) {
282278 m_expr, " invalid ast: unexpected binary operator" , node->GetLocation ());
283279}
284280
285- } // namespace lldb_private::dil
281+ } // namespace lldb_private::dil
0 commit comments