aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r--llvm/unittests/Support/Casting.cpp8
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp4
-rw-r--r--llvm/unittests/Support/KnownBitsTest.cpp20
-rw-r--r--llvm/unittests/Support/NativeFormatTests.cpp4
-rw-r--r--llvm/unittests/Support/Path.cpp10
-rw-r--r--llvm/unittests/Support/TypeTraitsTest.cpp2
6 files changed, 24 insertions, 24 deletions
diff --git a/llvm/unittests/Support/Casting.cpp b/llvm/unittests/Support/Casting.cpp
index 8ccabae..ed05963 100644
--- a/llvm/unittests/Support/Casting.cpp
+++ b/llvm/unittests/Support/Casting.cpp
@@ -235,7 +235,7 @@ TEST(CastingTest, dyn_cast_or_null) {
TEST(CastingTest, dyn_cast_value_types) {
T1 t1;
- Optional<T2> t2 = dyn_cast<T2>(t1);
+ std::optional<T2> t2 = dyn_cast<T2>(t1);
EXPECT_TRUE(t2);
T2 *t2ptr = dyn_cast<T2>(&t1);
@@ -246,12 +246,12 @@ TEST(CastingTest, dyn_cast_value_types) {
}
TEST(CastingTest, dyn_cast_if_present) {
- Optional<T1> empty{};
- Optional<T2> F1 = dyn_cast_if_present<T2>(empty);
+ std::optional<T1> empty{};
+ std::optional<T2> F1 = dyn_cast_if_present<T2>(empty);
EXPECT_FALSE(F1.has_value());
T1 t1;
- Optional<T2> F2 = dyn_cast_if_present<T2>(t1);
+ std::optional<T2> F2 = dyn_cast_if_present<T2>(t1);
EXPECT_TRUE(F2.has_value());
T1 *t1Null = nullptr;
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index 16118a9..11f9320 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -1070,7 +1070,7 @@ static Error createAnyError() {
}
struct MoveOnlyBox {
- Optional<int> Box;
+ std::optional<int> Box;
explicit MoveOnlyBox(int I) : Box(I) {}
MoveOnlyBox() = default;
@@ -1117,7 +1117,7 @@ TEST(Error, moveInto) {
// Check that this works with optionals too.
{
// Same cases as above.
- Optional<MoveOnlyBox> MaybeV;
+ std::optional<MoveOnlyBox> MaybeV;
EXPECT_THAT_ERROR(makeFailure().moveInto(MaybeV), Failed());
EXPECT_EQ(std::nullopt, MaybeV);
diff --git a/llvm/unittests/Support/KnownBitsTest.cpp b/llvm/unittests/Support/KnownBitsTest.cpp
index 1d609e9..0c3d9df 100644
--- a/llvm/unittests/Support/KnownBitsTest.cpp
+++ b/llvm/unittests/Support/KnownBitsTest.cpp
@@ -347,16 +347,16 @@ TEST(KnownBitsTest, ICmpExhaustive) {
});
});
- Optional<bool> KnownEQ = KnownBits::eq(Known1, Known2);
- Optional<bool> KnownNE = KnownBits::ne(Known1, Known2);
- Optional<bool> KnownUGT = KnownBits::ugt(Known1, Known2);
- Optional<bool> KnownUGE = KnownBits::uge(Known1, Known2);
- Optional<bool> KnownULT = KnownBits::ult(Known1, Known2);
- Optional<bool> KnownULE = KnownBits::ule(Known1, Known2);
- Optional<bool> KnownSGT = KnownBits::sgt(Known1, Known2);
- Optional<bool> KnownSGE = KnownBits::sge(Known1, Known2);
- Optional<bool> KnownSLT = KnownBits::slt(Known1, Known2);
- Optional<bool> KnownSLE = KnownBits::sle(Known1, Known2);
+ std::optional<bool> KnownEQ = KnownBits::eq(Known1, Known2);
+ std::optional<bool> KnownNE = KnownBits::ne(Known1, Known2);
+ std::optional<bool> KnownUGT = KnownBits::ugt(Known1, Known2);
+ std::optional<bool> KnownUGE = KnownBits::uge(Known1, Known2);
+ std::optional<bool> KnownULT = KnownBits::ult(Known1, Known2);
+ std::optional<bool> KnownULE = KnownBits::ule(Known1, Known2);
+ std::optional<bool> KnownSGT = KnownBits::sgt(Known1, Known2);
+ std::optional<bool> KnownSGE = KnownBits::sge(Known1, Known2);
+ std::optional<bool> KnownSLT = KnownBits::slt(Known1, Known2);
+ std::optional<bool> KnownSLE = KnownBits::sle(Known1, Known2);
EXPECT_EQ(AllEQ || NoneEQ, KnownEQ.has_value());
EXPECT_EQ(AllNE || NoneNE, KnownNE.has_value());
diff --git a/llvm/unittests/Support/NativeFormatTests.cpp b/llvm/unittests/Support/NativeFormatTests.cpp
index 591a68f..197fad1 100644
--- a/llvm/unittests/Support/NativeFormatTests.cpp
+++ b/llvm/unittests/Support/NativeFormatTests.cpp
@@ -26,7 +26,7 @@ template <typename T> std::string format_number(T N, IntegerStyle Style) {
}
std::string format_number(uint64_t N, HexPrintStyle Style,
- Optional<size_t> Width = std::nullopt) {
+ std::optional<size_t> Width = std::nullopt) {
std::string S;
llvm::raw_string_ostream Str(S);
write_hex(Str, N, Style, Width);
@@ -35,7 +35,7 @@ std::string format_number(uint64_t N, HexPrintStyle Style,
}
std::string format_number(double D, FloatStyle Style,
- Optional<size_t> Precision = std::nullopt) {
+ std::optional<size_t> Precision = std::nullopt) {
std::string S;
llvm::raw_string_ostream Str(S);
write_double(Str, D, Style, Precision);
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index d649deb..16e0f04 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -454,7 +454,7 @@ std::string getEnvWin(const wchar_t *Var) {
// RAII helper to set and restore an environment variable.
class WithEnv {
const char *Var;
- llvm::Optional<std::string> OriginalValue;
+ std::optional<std::string> OriginalValue;
public:
WithEnv(const char *Var, const char *Value) : Var(Var) {
@@ -1767,7 +1767,7 @@ static void verifyFileContents(const Twine &Path, StringRef Contents) {
TEST_F(FileSystemTest, CreateNew) {
int FD;
- Optional<FileDescriptorCloser> Closer;
+ std::optional<FileDescriptorCloser> Closer;
// Succeeds if the file does not exist.
ASSERT_FALSE(fs::exists(NonExistantFile));
@@ -1791,7 +1791,7 @@ TEST_F(FileSystemTest, CreateNew) {
TEST_F(FileSystemTest, CreateAlways) {
int FD;
- Optional<FileDescriptorCloser> Closer;
+ std::optional<FileDescriptorCloser> Closer;
// Succeeds if the file does not exist.
ASSERT_FALSE(fs::exists(NonExistantFile));
@@ -1869,7 +1869,7 @@ TEST_F(FileSystemTest, AppendSetsCorrectFileOffset) {
// the specified disposition.
for (fs::CreationDisposition Disp : Disps) {
int FD;
- Optional<FileDescriptorCloser> Closer;
+ std::optional<FileDescriptorCloser> Closer;
createFileWithData(NonExistantFile, false, fs::CD_CreateNew, "Fizz");
@@ -1975,7 +1975,7 @@ TEST_F(FileSystemTest, readNativeFileToEOF) {
createFileWithData(NonExistantFile, false, fs::CD_CreateNew, Content);
FileRemover Cleanup(NonExistantFile);
const auto &Read = [&](SmallVectorImpl<char> &V,
- Optional<ssize_t> ChunkSize) {
+ std::optional<ssize_t> ChunkSize) {
Expected<fs::file_t> FD = fs::openNativeFileForRead(NonExistantFile);
if (!FD)
return FD.takeError();
diff --git a/llvm/unittests/Support/TypeTraitsTest.cpp b/llvm/unittests/Support/TypeTraitsTest.cpp
index 734e50a..71383ac 100644
--- a/llvm/unittests/Support/TypeTraitsTest.cpp
+++ b/llvm/unittests/Support/TypeTraitsTest.cpp
@@ -118,7 +118,7 @@ TEST(Triviality, ADT) {
TrivialityTester<llvm::StringRef, true, true>();
TrivialityTester<llvm::ArrayRef<int>, true, true>();
TrivialityTester<llvm::PointerIntPair<int *, 2>, true, true>();
- TrivialityTester<llvm::Optional<int>, true, true>();
+ TrivialityTester<std::optional<int>, true, true>();
}
} // namespace triviality