[all-commits] [llvm/llvm-project] 14642d: [lldb] Fix member access in GetExpressionPath

Tonko Sabolčec via All-commits all-commits at lists.llvm.org
Fri Sep 30 04:26:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14642dc7405ebd93a46dda1f2dba616395660715
      https://github.com/llvm/llvm-project/commit/14642dc7405ebd93a46dda1f2dba616395660715
  Author: Tonko Sabolčec <tonkosi123 at gmail.com>
  Date:   2022-09-30 (Fri, 30 Sep 2022)

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

  Log Message:
  -----------
  [lldb] Fix member access in GetExpressionPath

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".

Reviewed By: werat, clayborg

Differential Revision: https://reviews.llvm.org/D132734




More information about the All-commits mailing list