[lld] d6684f2 - [lld] Use std::optional instead of None in comments (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 10 17:05:01 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T17:04:56-08:00
New Revision: d6684f2cb284580c05baeb7247c28dc929b517e7
URL: https://github.com/llvm/llvm-project/commit/d6684f2cb284580c05baeb7247c28dc929b517e7
DIFF: https://github.com/llvm/llvm-project/commit/d6684f2cb284580c05baeb7247c28dc929b517e7.diff
LOG: [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
Added:
Modified:
lld/COFF/Driver.cpp
lld/COFF/InputFiles.cpp
lld/COFF/PDB.cpp
Removed:
################################################################################
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 91497e781228a..58bb15e7d37a7 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -482,7 +482,7 @@ static std::optional<sys::fs::UniqueID> 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<StringRef> 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<StringRef> LinkerDriver::findLib(StringRef filename) {
if (config->noDefaultLibAll)
return std::nullopt;
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 66a6b85224686..3e9b48b2f3b5a 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<Symbol *> 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 ecb4656cf61fe..ad5137019ceb1 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<std::pair<StringRef, uint32_t>>
lld::coff::getFileLineCodeView(const SectionChunk *c, uint32_t addr) {
ExitOnError exitOnErr;
More information about the llvm-commits
mailing list