[libc][Obvious] Fix memory function benchmarks after removal of None.

This commit is contained in:
Siva Chandra Reddy 2022-12-11 00:20:33 +00:00
parent f340030577
commit 8dcb7f6b6f
3 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,7 @@
#include <chrono>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <vector>
@ -86,7 +87,7 @@ static Error fromJson(const json::Value &V, MaybeAlign &Out) {
"Can't parse Align, not an Integer");
const int64_t Value = *MaybeInt;
if (!Value) {
Out = None;
Out = std::nullopt;
return Error::success();
}
if (isPowerOf2_64(Value)) {
@ -108,7 +109,7 @@ static Error fromJson(const json::Value &V,
.Case("None", libc_benchmarks::BenchmarkLog::None)
.Case("Last", libc_benchmarks::BenchmarkLog::Last)
.Case("Full", libc_benchmarks::BenchmarkLog::Full)
.Default(None);
.Default(std::nullopt);
if (!Parsed)
return createStringError(errc::io_error,
Twine("Can't parse BenchmarkLog, invalid value '")

View File

@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Alignment.h"
#include <cstdint>
#include <optional>
#include <random>
namespace llvm {
@ -58,7 +59,7 @@ struct StudyConfiguration {
// None : Use a fixed address that is at least cache line aligned,
// 1 : Use random address,
// >1 : Use random address aligned to value.
MaybeAlign AccessAlignment = None;
MaybeAlign AccessAlignment = std::nullopt;
// When Function == 'memcmp', this is the buffers mismatch position.
// 0 : Buffers always compare equal,

View File

@ -10,6 +10,7 @@
#include "llvm/Support/Alignment.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>
using testing::AllOf;
using testing::AnyOf;
@ -35,7 +36,7 @@ TEST(AlignedBuffer, Empty) {
TEST(OffsetDistribution, AlignToBegin) {
const size_t BufferSize = 8192;
OffsetDistribution OD(BufferSize, 1024, None);
OffsetDistribution OD(BufferSize, 1024, std::nullopt);
std::default_random_engine Gen;
for (size_t I = 0; I <= 10; ++I)
EXPECT_EQ(OD(Gen), 0U);