summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/APSIntTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix build when both gtest death tests and LLVM_NODISCARD are available.Richard Smith2019-07-311-2/+2
| | | | llvm-svn: 367495
* [APSInt][OpenMP] Fix isNegative, etc. for unsigned typesJoel E. Denny2019-04-231-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch, APSInt inherits APInt::isNegative, which merely checks the sign bit without regard to whether the type is actually signed. isNonNegative and isStrictlyPositive call isNegative and so are also affected. This patch adjusts APSInt to override isNegative, isNonNegative, and isStrictlyPositive with implementations that consider whether the type is signed. A large set of Clang OpenMP tests are affected. Without this patch, these tests assume that `true` is not a valid argument for clauses like `collapse`. Indeed, `true` fails APInt::isStrictlyPositive but not APSInt::isStrictlyPositive. This patch adjusts those tests to assume `true` should be accepted. This patch also adds tests revealing various other similar fixes due to APSInt::isNegative calls in Clang's ExprConstant.cpp and SemaExpr.cpp: `++` and `--` overflow in `constexpr`, evaluated object size based on `alloc_size`, `<<` and `>>` shift count validation, and OpenMP array section validation. Reviewed By: lebedev.ri, ABataev, hfinkel Differential Revision: https://reviews.llvm.org/D59712 llvm-svn: 359012
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* ADTTests: merge #ifdef checks from r240436.Alex Lorenz2015-06-241-3/+1
| | | | | | | This commit merges the #ifdef and #ifndef checks into one #if, as suggested by Duncan P. N. Exon Smith. llvm-svn: 240553
* ADT: Add a string APSInt constructor.Alex Lorenz2015-06-231-0/+19
| | | | | | | | | | | | This commit moves the APSInt initialization code that's used by the LLLexer class into a new APSInt constructor that constructs APSInts from strings. This change is useful for MIR Serialization, as it would allow the MILexer class to use the same APSInt initialization as LLexer when parsing immediate machine operands. llvm-svn: 240436
* ADT: Add int64_t interoperability to APSIntDuncan P. N. Exon Smith2015-02-051-0/+102
| | | | | | | | | | | | | | | | Add some API to `APSInt` to make it easier to compare with `int64_t`. - `APSInt::compareValues(APSInt, APSInt)` returns 1, -1 or 0 for greater, lesser, or equal, doing the right thing for mismatched "has-sign" and bitwidths. This is just like `isSameValue()` (and is now the implementation of it). - `APSInt::get(int64_t)` gets a signed `APSInt`. - `operator<(int64_t)`, etc., are implemented trivially via `get()` and `compareValues()`. - Also added `APSInt::getUnsigned(uint64_t)` to make it easier to test `compareValues()`. llvm-svn: 228239
* Give APInt move semantics.Benjamin Kramer2014-03-021-0/+44
The interaction between defaulted operators and move elision isn't totally obvious, add a unit test so it doesn't break unintentionally. llvm-svn: 202662
OpenPOWER on IntegriCloud