[all-commits] [llvm/llvm-project] a3fe9c: [clang][dataflow] Retrieve members from accessors ...

Samira Bazuzi via All-commits all-commits at lists.llvm.org
Mon Dec 4 01:10:21 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3fe9cb24da302a40c53d187271e472a6432c4f1
      https://github.com/llvm/llvm-project/commit/a3fe9cb24da302a40c53d187271e472a6432c4f1
  Author: Samira Bazuzi <bazuzi at users.noreply.github.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
    M clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Retrieve members from accessors called using member… (#73978)

… pointers.

getMethodDecl does not handle pointers to members and returns nullptr
for them. getMethodDecl contains a decade-plus-old FIXME to handle
pointers to members, but two approaches I looked at for fixing it are
more invasive or complex than simply swapping to getCalleeDecl.

The first, have getMethodDecl call getCalleeDecl, creates a large tree
of const-ness mismatches due to getMethodDecl returning a non-const
value while being a const member function and getCalleeDecl only being a
const member function when it returns a const value.

The second, implementing an AST walk to match how
CXXMemberCallExpr::getImplicitObjectArgument grabs the LHS of the binary
operator, is basically reimplementing Expr::getReferencedDeclOfCallee,
which is used by Expr::getCalleeDecl. We don't need another copy of that
code.




More information about the All-commits mailing list