aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-07 10:04:25 -0800
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-07 15:27:38 -0800
commit49e75ebd854dee1fcf5729c264f4cfadf76e952d (patch)
tree1ca0821a28279b4efdbfdaf8993c3eea1be4eed0 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parenta0568eabaf85cdb4f89bda9e75a49a70c165af7c (diff)
downloadllvm-49e75ebd854dee1fcf5729c264f4cfadf76e952d.zip
llvm-49e75ebd854dee1fcf5729c264f4cfadf76e952d.tar.gz
llvm-49e75ebd854dee1fcf5729c264f4cfadf76e952d.tar.bz2
[Bitcode(Reader|Writer)] Convert Optional to std::optional
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp14
1 files changed, 7 insertions, 7 deletions
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 <iterator>
#include <map>
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -525,7 +525,7 @@ private:
void writeModStrings();
void writeCombinedGlobalValueSummary();
- Optional<unsigned> getValueId(GlobalValue::GUID ValGUID) {
+ std::optional<unsigned> 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<unsigned> ValueID = GetValueID(Call.Callee);
+ std::optional<unsigned> 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<FunctionSummary>(Summary);
writeFunctionTypeMetadataRecords(
- Stream, FS, [&](const ValueInfo &VI) -> Optional<unsigned> {
+ Stream, FS, [&](const ValueInfo &VI) -> std::optional<unsigned> {
return {VE.getValueID(VI.getValue())};
});
@@ -4429,7 +4429,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
return;
}
- auto GetValueId = [&](const ValueInfo &VI) -> Optional<unsigned> {
+ auto GetValueId = [&](const ValueInfo &VI) -> std::optional<unsigned> {
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<unsigned> ValueID = GetValueId(VI);
+ std::optional<unsigned> 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<unsigned> CallValueId = GetValueId(EI.first);
+ std::optional<unsigned> CallValueId = GetValueId(EI.first);
if (!CallValueId)
continue;
NameVals.push_back(*CallValueId);