[Lldb-commits] [PATCH] D132734: [lldb] Fix member access in GetExpressionPath

Tonko SabolĨec via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 26 05:32:05 PDT 2022


tonkosi created this revision.
tonkosi added reviewers: werat, Michael137.
Herald added a project: All.
tonkosi requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This change fixes two issues in ValueObject::GetExpressionPath method:

1. Accessing members of struct references used to produce expression paths such as "str.&str.member" (instead of the expected "str.member"). This is fixed by assigning the flag tha the child value is a dereference when calling Dereference() on references and adjusting logic in expression path creation.
2. If the parent of member access is dereference, the produced expression path was "*(ptr).member". This is incorrect, since it dereferences the member instead of the pointer. This is fixed by wrapping dereference expression into parenthesis, resulting with "(*(ptr)).member".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132734

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/python_api/expression_path/Makefile
  lldb/test/API/python_api/expression_path/TestExpressionPath.py
  lldb/test/API/python_api/expression_path/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132734.455878.patch
Type: text/x-patch
Size: 15226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220826/d2886b73/attachment-0001.bin>


More information about the lldb-commits mailing list