[all-commits] [llvm/llvm-project] 974c8b: [c++20] Add rewriting from comparison operators to...

Richard Smith via All-commits all-commits at lists.llvm.org
Fri Oct 18 17:03:38 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 974c8b7e2fde550fd87850d50695341101c38c2d
      https://github.com/llvm/llvm-project/commit/974c8b7e2fde550fd87850d50695341101c38c2d
  Author: Richard Smith <richard-llvm at metafoo.co.uk>
  Date:   2019-10-19 (Sat, 19 Oct 2019)

  Changed paths:
    M clang/include/clang/AST/ExprCXX.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/OperatorKinds.h
    M clang/include/clang/Sema/Overload.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ExprCXX.cpp
    M clang/lib/Frontend/FrontendActions.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/lib/Sema/TreeTransform.h
    A clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
    A clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p8-2a.cpp
    A clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p9-2a.cpp
    M clang/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp
    A clang/test/CodeGenCXX/mangle-cxx2a.cpp
    M clang/test/PCH/cxx2a-compare.cpp
    M clang/test/SemaCXX/compare-cxx2a.cpp
    M clang/test/SemaCXX/self-comparison.cpp
    M clang/www/cxx_status.html

  Log Message:
  -----------
  [c++20] Add rewriting from comparison operators to <=> / ==.

This adds support for rewriting <, >, <=, and >= to a normal or reversed
call to operator<=>, for rewriting != to a normal or reversed call to
operator==, and for rewriting <=> and == to reversed forms of those same
operators.

Note that this is a breaking change for various C++17 code patterns,
including some in use in LLVM. The most common patterns (where an
operator== becomes ambiguous with a reversed form of itself) are still
accepted under this patch, as an extension (with a warning). I'm hopeful
that we can get the language rules fixed before C++20 ships, and the
extension warning is aimed primarily at providing data to inform that
decision.

llvm-svn: 375306




More information about the All-commits mailing list