From d6684f2cb284580c05baeb7247c28dc929b517e7 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 10 Dec 2022 17:04:56 -0800 Subject: [PATCH] [lld] Use std::optional instead of None in comments (NFC) This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 --- lld/COFF/Driver.cpp | 4 ++-- lld/COFF/InputFiles.cpp | 10 +++++----- lld/COFF/PDB.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 91497e7..58bb15e 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -482,7 +482,7 @@ static std::optional getUniqueID(StringRef path) { } // Resolves a file path. This never returns the same path -// (in that case, it returns None). +// (in that case, it returns std::nullopt). std::optional LinkerDriver::findFile(StringRef filename) { StringRef path = doFindFile(filename); @@ -525,7 +525,7 @@ StringRef LinkerDriver::doFindLib(StringRef filename) { // Resolves a library path. /nodefaultlib options are taken into // consideration. This never returns the same path (in that case, -// it returns None). +// it returns std::nullopt). std::optional LinkerDriver::findLib(StringRef filename) { if (config->noDefaultLibAll) return std::nullopt; diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 66a6b85..3e9b48b 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -403,9 +403,9 @@ void ObjFile::initializeSymbols() { if (config->mingw && prevailingComdat) recordPrevailingSymbolForMingw(coffSym, prevailingSectionMap); } else { - // createDefined() returns None if a symbol belongs to a section that - // was pending at the point when the symbol was read. This can happen in - // two cases: + // createDefined() returns std::nullopt if a symbol belongs to a section + // that was pending at the point when the symbol was read. This can happen + // in two cases: // 1) section definition symbol for a comdat leader; // 2) symbol belongs to a comdat section associated with another section. // In both of these cases, we can expect the section to be resolved by @@ -629,8 +629,8 @@ std::optional ObjFile::createDefined( // The second symbol entry has the name of the comdat symbol, called the // "comdat leader". // When this function is called for the first symbol entry of a comdat, - // it sets comdatDefs and returns None, and when it's called for the second - // symbol entry it reads comdatDefs and then sets it back to nullptr. + // it sets comdatDefs and returns std::nullopt, and when it's called for the + // second symbol entry it reads comdatDefs and then sets it back to nullptr. // Handle comdat leader. if (const coff_aux_section_definition *def = comdatDefs[sectionNumber]) { diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index ecb4656..ad51370 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -1775,8 +1775,8 @@ static bool findLineTable(const SectionChunk *c, uint32_t addr, } // Use CodeView line tables to resolve a file and line number for the given -// offset into the given chunk and return them, or None if a line table was -// not found. +// offset into the given chunk and return them, or std::nullopt if a line table +// was not found. std::optional> lld::coff::getFileLineCodeView(const SectionChunk *c, uint32_t addr) { ExitOnError exitOnErr; -- 2.7.4