summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/OptionalTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ADT] Make moving Optional not reset the Optional it moves from.Benjamin Kramer2018-01-251-6/+6
| | | | | | | | | This brings it in line with std::optional. My recent changes to make Optional of trivial types trivially copyable introduced diverging behavior depending on the type, which is bad. Now all types have the same moving behavior. llvm-svn: 323445
* [ADT] Just give up on GCC, I can't fix this.Benjamin Kramer2018-01-181-2/+1
| | | | | | | | | | While the memmove workaround fixed it for GCC 6.3. GCC 4.8 and GCC 7.1 are still broken. I have no clue what's going on, just blacklist GCC for now. Needless to say this code is ubsan, asan and msan-clean. llvm-svn: 322862
* [ADT] Split optional to only include copy mechanics and dtor for non-trivial ↵Benjamin Kramer2018-01-181-0/+9
| | | | | | | | | | | | | types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. This is a re-land of r317019, which had issues with GCC 4.8 back then. Those issues don't reproduce anymore, but I'll watch the buildbots closely in case anything goes wrong. llvm-svn: 322838
* Revert rL317019, "[ADT] Split optional to only include copy mechanics and ↵NAKAMURA Takumi2017-11-011-9/+0
| | | | | | | | dtor for non-trivial types." Seems g++-4.8 (eg. Ubuntu 14.04) doesn't like this. llvm-svn: 317077
* [ADT] Split optional to only include copy mechanics and dtor for non-trivial ↵Benjamin Kramer2017-10-311-0/+9
| | | | | | | | | types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. llvm-svn: 317019
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* [ADT] Add relation operators for OptionalTim Shen2016-08-111-11/+139
| | | | | | | | | | | | Summary: Make Optional's behavior the same as the coming std::optional. Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23178 llvm-svn: 278397
* Allow Optionals to be compared to NoneDavid Blaikie2015-08-191-0/+13
| | | | | | | | | | | This is something like nullopt in std::experimental::optional. Optional could already be constructed from None, so this seems like an obvious extension from there. I have a use in a future patch for Clang, though it may not go that way/end up used - so this seemed worth committing now regardless. llvm-svn: 245518
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-5/+5
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* Update test name to match changes made in r218783David Blaikie2014-10-011-1/+1
| | | | | | Addressing post commit review feedback from Justin Bogner. llvm-svn: 218821
* Add an immovable type to test Optional<T>::emplace more rigorously after ↵David Blaikie2014-10-011-5/+26
| | | | | | r218732. llvm-svn: 218783
* ADTTests/OptionalTest.cpp: Use LLVM_DELETED_FUNCTION.NAKAMURA Takumi2014-10-011-4/+4
| | | | llvm-svn: 218750
* Add an emplace(...) method to llvm::Optional<T>.Jordan Rose2014-10-011-0/+49
| | | | | | | | | | | | | This can be used for in-place initialization of non-moveable types. For compilers that don't support variadic templates, only up to four arguments are supported. We can always add more, of course, but this should be good enough until we move to a later MSVC that has full support for variadic templates. Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS. Reviewed by David Blaikie. llvm-svn: 218732
* Add getValueOr to llvm::Optional<T>.Jordan Rose2014-09-291-0/+29
| | | | | | | | | | This takes a single argument convertible to T, and - if the Optional has a value, returns the existing value, - otherwise, constructs a T from the argument and returns that. Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS. llvm-svn: 218618
* [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.Chandler Carruth2014-03-011-2/+0
| | | | llvm-svn: 202583
* Only include move-related Optional<T> tests when rvalue references are ↵David Blaikie2013-02-211-30/+32
| | | | | | available. llvm-svn: 175730
* Add move ctor/assignment to Optional<T>David Blaikie2013-02-211-0/+109
| | | | | | Code review feedback for r175580 by Jordan Rose. llvm-svn: 175729
* Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.David Blaikie2013-02-201-1/+1
| | | | | | Code review feedback on r175580 from Jordan Rose. llvm-svn: 175595
* Allow llvm::Optional to work with types without default constructors.David Blaikie2013-02-201-0/+173
This generalizes Optional to require less from the T type by using aligned storage for backing & placement new/deleting the T into it when necessary. Also includes unit tests. llvm-svn: 175580
OpenPOWER on IntegriCloud