[all-commits] [llvm/llvm-project] 5fbe21: [clang] p2085 out-of-class comparison operator def...

Nathan Sidwell via All-commits all-commits at lists.llvm.org
Thu Dec 16 07:23:07 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fbe21a7748f91adbd1b16c95bbfe180642320a3
      https://github.com/llvm/llvm-project/commit/5fbe21a7748f91adbd1b16c95bbfe180642320a3
  Author: Nathan Sidwell <nathan at acm.org>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
    A clang/test/CodeGenCXX/p2085.cpp
    M clang/www/cxx_status.html

  Log Message:
  -----------
  [clang] p2085 out-of-class comparison operator defaulting

This implements p2085, allowing out-of-class defaulting of comparison
operators, primarily so they need not be inline, IIUC intent. this was
mostly straigh forward, but required reimplementing
Sema::CheckExplicitlyDefaultedComparison, as now there's a case where
we have no a priori clue as to what class a defaulted comparison may
be for. We have to inspect the parameter types to find out. Eg:

class X { ... };
bool operator==(X, X) = default;

Thus reimplemented the parameter type checking, and added 'is this a
friend' functionality for the above case.

Reviewed By: mizvekov

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


  Commit: dd073e08aeb56b53c148f27226ce6564943bc86e
      https://github.com/llvm/llvm-project/commit/dd073e08aeb56b53c148f27226ce6564943bc86e
  Author: Nathan Sidwell <nathan at acm.org>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
    M llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
    M llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp

  Log Message:
  -----------
  Avoid by-value copies of referenced objects

These were detected by the new -Wauto-by-value-copy (D114989) warning, these by-value
constant copies need only be references.

Reviewed By: aaron.ballman

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


Compare: https://github.com/llvm/llvm-project/compare/5aefb1dc1eab...dd073e08aeb5


More information about the All-commits mailing list