[all-commits] [llvm/llvm-project] 0612c9: [clang][dataflow] Ignore assignment where base cla...

Kinuko Yasuda via All-commits all-commits at lists.llvm.org
Thu Sep 14 11:46:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0612c9b09a2b8609069eeca0f08957fdb5de45fa
      https://github.com/llvm/llvm-project/commit/0612c9b09a2b8609069eeca0f08957fdb5de45fa
  Author: Kinuko Yasuda <kinuko at chromium.org>
  Date:   2023-09-14 (Thu, 14 Sep 2023)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Ignore assignment where base class's operator is used (#66364)

In C++ it seems it is legit to use base class's operator (e.g. `using
Base::operator=`) to perform copy if the base class is the common
ancestor of the source and destination object. In such a case we
shouldn't try to access fields beyond that of the base class, however
such a case seems to be very rare (typical code would implement a copy
constructor instead), and could add complexities, so in this patch we
simply bail if the method operator's parent class is different from the
type of the destination object that this framework recognizes.




More information about the All-commits mailing list