From 49e75ebd854dee1fcf5729c264f4cfadf76e952d Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Wed, 7 Dec 2022 10:04:25 -0800 Subject: [Bitcode(Reader|Writer)] Convert Optional to std::optional --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 12358bb..9c45ea0 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -17,7 +17,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/None.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" @@ -78,6 +77,7 @@ #include #include #include +#include #include #include #include @@ -525,7 +525,7 @@ private: void writeModStrings(); void writeCombinedGlobalValueSummary(); - Optional getValueId(GlobalValue::GUID ValGUID) { + std::optional getValueId(GlobalValue::GUID ValGUID) { auto VMI = GUIDToValueIdMap.find(ValGUID); if (VMI == GUIDToValueIdMap.end()) return std::nullopt; @@ -3811,7 +3811,7 @@ static void writeFunctionTypeMetadataRecords(BitstreamWriter &Stream, Record.push_back(Arg.Calls.size()); for (auto &Call : Arg.Calls) { Record.push_back(Call.ParamNo); - Optional ValueID = GetValueID(Call.Callee); + std::optional ValueID = GetValueID(Call.Callee); if (!ValueID) { // If ValueID is unknown we can't drop just this call, we must drop // entire parameter. @@ -3975,7 +3975,7 @@ void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord( FunctionSummary *FS = cast(Summary); writeFunctionTypeMetadataRecords( - Stream, FS, [&](const ValueInfo &VI) -> Optional { + Stream, FS, [&](const ValueInfo &VI) -> std::optional { return {VE.getValueID(VI.getValue())}; }); @@ -4429,7 +4429,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { return; } - auto GetValueId = [&](const ValueInfo &VI) -> Optional { + auto GetValueId = [&](const ValueInfo &VI) -> std::optional { if (!VI) return std::nullopt; return getValueId(VI.getGUID()); @@ -4443,7 +4443,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { Stream, FS, CallsiteAbbrev, AllocAbbrev, /*PerModule*/ false, /*GetValueId*/ [&](const ValueInfo &VI) -> unsigned { - Optional ValueID = GetValueId(VI); + std::optional ValueID = GetValueId(VI); // This can happen in shared index files for distributed ThinLTO if // the callee function summary is not included. Record 0 which we // will have to deal with conservatively when doing any kind of @@ -4499,7 +4499,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { for (auto &EI : FS->calls()) { // If this GUID doesn't have a value id, it doesn't have a function // summary and we don't need to record any calls to it. - Optional CallValueId = GetValueId(EI.first); + std::optional CallValueId = GetValueId(EI.first); if (!CallValueId) continue; NameVals.push_back(*CallValueId); -- cgit v1.1