summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/compare-cxx2a.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [c++20] P1959R0: Remove support for std::*_equality.Richard Smith2019-12-161-43/+34
|
* [c++20] Fix incorrect assumptions in checks for comparison category types.Richard Smith2019-12-091-0/+3
| | | | | | In the presence of modules, we can have multiple lookup results for the same entity, and we need to re-check for completeness each time we consider a type.
* Fix crash if a user-defined conversion is applied in the middle of aRichard Smith2019-12-051-0/+5
| | | | rewrite of an operator in terms of operator<=>.
* [c++20] Add rewriting from comparison operators to <=> / ==.Richard Smith2019-10-191-4/+4
| | | | | | | | | | | | | | | | | 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
* Merge and improve code that detects same value in comparisons.Richard Trieu2019-09-211-0/+6
| | | | | | | | | | | | -Wtautological-overlap-compare and self-comparison from -Wtautological-compare relay on detecting the same operand in different locations. Previously, each warning had it's own operand checker. Now, both are merged together into one function that each can call. The function also now looks through member access and array accesses. Differential Revision: https://reviews.llvm.org/D66045 llvm-svn: 372453
* Diagnose both _Complex and _Imaginary as C99 extensions.Aaron Ballman2019-08-271-4/+4
| | | | llvm-svn: 370100
* [C++2a] Implement operator<=>: Address bugs and post-commit review comments ↵Eric Fiselier2018-05-081-1/+0
| | | | | | | | | | | | after r331677. This patch addresses some mostly trivial post-commit review comments received on r331677. Additionally, this patch fixes an assertion in `getNarrowingKind` caused by the use of an uninitialized value from `checkThreeWayNarrowingConversion`. llvm-svn: 331707
* [C++2a] Implement operator<=> CodeGen and ExprConstantEric Fiselier2018-05-071-37/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback. The main changes are: * Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes. * Implement [expr.spaceship] checking, including diagnosing narrowing conversions. * Implement `ExprConstant` for builtin spaceship operators. * Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp. * Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround. Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall Reviewed By: rjmccall Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D45476 llvm-svn: 331677
* Add tests for three-way self- and array comparison.Richard Smith2018-01-071-0/+8
| | | | llvm-svn: 321973
* [c++20] P0515R3: Parsing support and basic AST construction for operator <=>.Richard Smith2017-12-141-0/+166
Adding the new enumerator forced a bunch more changes into this patch than I would have liked. The -Wtautological-compare warning was extended to properly check the new comparison operator, clang-format needed updating because it uses precedence levels as weights for determining where to break lines (and several operators increased their precedence levels with this change), thread-safety analysis needed changes to build its own IL properly for the new operator. All "real" semantic checking for this operator has been deferred to a future patch. For now, we use the relational comparison rules and arbitrarily give the builtin form of the operator a return type of 'void'. llvm-svn: 320707
OpenPOWER on IntegriCloud