wpiutil: Replace LLVM Optional with C++17-compatible optional

Imported from https://github.com/akrzemi1/Optional with minor changes:
- Compiler conditional simplifications (we only use recent versions)
- Move from std::experimental to wpi namespace
- Change tests to integrate with Google Test

Update LLVM use cases.
This commit is contained in:
Peter Johnson
2018-11-19 22:57:34 -08:00
parent 489701cacc
commit 0b03454366
14 changed files with 2494 additions and 422 deletions

View File

@@ -11,7 +11,7 @@
#define WPIUTIL_WPI_ARRAYREF_H
#include "wpi/Hashing.h"
#include "wpi/None.h"
#include "wpi/optional.h"
#include "wpi/SmallVector.h"
#include "wpi/STLExtras.h"
#include "wpi/Compiler.h"
@@ -60,8 +60,8 @@ namespace wpi {
/// Construct an empty ArrayRef.
/*implicit*/ ArrayRef() = default;
/// Construct an empty ArrayRef from None.
/*implicit*/ ArrayRef(NoneType) {}
/// Construct an empty ArrayRef from nullopt.
/*implicit*/ ArrayRef(nullopt_t) {}
/// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt)
@@ -296,8 +296,8 @@ namespace wpi {
/// Construct an empty MutableArrayRef.
/*implicit*/ MutableArrayRef() = default;
/// Construct an empty MutableArrayRef from None.
/*implicit*/ MutableArrayRef(NoneType) : ArrayRef<T>() {}
/// Construct an empty MutableArrayRef from nullopt.
/*implicit*/ MutableArrayRef(nullopt_t) : ArrayRef<T>() {}
/// Construct an MutableArrayRef from a single element.
/*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef<T>(OneElt) {}