aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/OptionalTest.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-10-01Update test name to match changes made in r218783David Blaikie1-1/+1
Addressing post commit review feedback from Justin Bogner. llvm-svn: 218821
2014-10-01Add an immovable type to test Optional<T>::emplace more rigorously after ↵David Blaikie1-5/+26
r218732. llvm-svn: 218783
2014-10-01ADTTests/OptionalTest.cpp: Use LLVM_DELETED_FUNCTION.NAKAMURA Takumi1-4/+4
llvm-svn: 218750
2014-10-01Add an emplace(...) method to llvm::Optional<T>.Jordan Rose1-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
2014-09-29Add getValueOr to llvm::Optional<T>.Jordan Rose1-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
2014-03-01[C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.Chandler Carruth1-2/+0
llvm-svn: 202583
2013-02-21Only include move-related Optional<T> tests when rvalue references are ↵David Blaikie1-30/+32
available. llvm-svn: 175730
2013-02-21Add move ctor/assignment to Optional<T>David Blaikie1-0/+109
Code review feedback for r175580 by Jordan Rose. llvm-svn: 175729
2013-02-20Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.David Blaikie1-1/+1
Code review feedback on r175580 from Jordan Rose. llvm-svn: 175595
2013-02-20Allow llvm::Optional to work with types without default constructors.David Blaikie1-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