[all-commits] [llvm/llvm-project] 2369a5: [Clang] Fix handling of non-member functions in is...

smanna12 via All-commits all-commits at lists.llvm.org
Thu Nov 21 17:19:10 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2369a582c260aafd46ce09e75e884fb654fd330d
      https://github.com/llvm/llvm-project/commit/2369a582c260aafd46ce09e75e884fb654fd330d
  Author: smanna12 <soumi.manna at intel.com>
  Date:   2024-11-21 (Thu, 21 Nov 2024)

  Changed paths:
    M clang/lib/Sema/CheckExprLifetime.cpp

  Log Message:
  -----------
  [Clang] Fix handling of non-member functions in isNormalAssignmentOperator() (#115880)

This patch correctes the handling of non-member functions in the
`isNormalAssignmentOperator` function within `CheckExprLifetime.cpp`.

The previous implementation incorrectly assumed that `FunctionDecl` is
always a `CXXMethodDecl`, leading to potential null pointer
dereferencing.

Change: - Correctly handle the case where `FD` is not a `CXXMethodDecl`
by using `FD->getParamDecl(0)->getType()`.

This fix ensures that the function correctly handles non-member
assignment operators, such as:

`struct S {}; void operator|=(S, S) {}`

This change improves the robustness of the `isNormalAssignmentOperator`
function by correctly identifying and handling different types of
function declarations.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list