diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h index cb5933652a480..86a5fc4c2ae7d 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h @@ -169,7 +169,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// Reads the option with the check-local name \p LocalName from local or /// global ``CheckOptions``. Gets local option first. If local is not /// present, falls back to get global option. If global option is not - /// present either, return ``None``. + /// present either, return ``std::nullopt``. llvm::Optional getLocalOrGlobal(StringRef LocalName) const; /// Read a named option from the ``Context``. @@ -185,10 +185,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// /// Reads the option with the check-local name \p LocalName from the /// ``CheckOptions``. If the corresponding key is not present, return - /// ``None``. + /// ``std::nullopt``. /// /// If the corresponding key can't be parsed as a ``T``, emit a - /// diagnostic and return ``None``. + /// diagnostic and return ``std::nullopt``. template std::enable_if_t::value, llvm::Optional> get(StringRef LocalName) const { @@ -222,10 +222,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// Reads the option with the check-local name \p LocalName from local or /// global ``CheckOptions``. Gets local option first. If local is not /// present, falls back to get global option. If global option is not - /// present either, return ``None``. + /// present either, return ``std::nullopt``. /// /// If the corresponding key can't be parsed as a ``T``, emit a - /// diagnostic and return ``None``. + /// diagnostic and return ``std::nullopt``. template std::enable_if_t::value, llvm::Optional> getLocalOrGlobal(StringRef LocalName) const { @@ -266,10 +266,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// /// Reads the option with the check-local name \p LocalName from the /// ``CheckOptions``. If the corresponding key is not present, return - /// ``None``. + /// ``std::nullopt``. /// /// If the corresponding key can't be parsed as a ``T``, emit a - /// diagnostic and return ``None``. + /// diagnostic and return ``std::nullopt``. /// /// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to /// supply the mapping required to convert between ``T`` and a string. @@ -306,10 +306,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// Reads the option with the check-local name \p LocalName from local or /// global ``CheckOptions``. Gets local option first. If local is not /// present, falls back to get global option. If global option is not - /// present either, returns ``None``. + /// present either, returns ``std::nullopt``. /// /// If the corresponding key can't be parsed as a ``T``, emit a - /// diagnostic and return ``None``. + /// diagnostic and return ``std::nullopt``. /// /// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to /// supply the mapping required to convert between ``T`` and a string. @@ -428,10 +428,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// /// Reads the option with the check-local name \p LocalName from the /// ``CheckOptions``. If the corresponding key is not present, return -/// ``None``. +/// ``std::nullopt``. /// /// If the corresponding key can't be parsed as a bool, emit a -/// diagnostic and return ``None``. +/// diagnostic and return ``std::nullopt``. template <> llvm::Optional ClangTidyCheck::OptionsView::get(StringRef LocalName) const; diff --git a/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp b/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp index 076e8fd2f625f..d9c5302bd2daf 100644 --- a/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp +++ b/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp @@ -45,7 +45,7 @@ namespace tidy { enum class NoLintType { NoLint, NoLintNextLine, NoLintBegin, NoLintEnd }; // Convert a string like "NOLINTNEXTLINE" to its enum `Type::NoLintNextLine`. -// Return `None` if the string is unrecognized. +// Return `std::nullopt` if the string is unrecognized. static Optional strToNoLintType(StringRef Str) { auto Type = llvm::StringSwitch>(Str) .Case("NOLINT", NoLintType::NoLint) diff --git a/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp b/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp index 17ec54e587b4e..1e5ce5331f081 100644 --- a/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp @@ -20,7 +20,7 @@ namespace abseil { // Given the name of a duration factory function, return the appropriate // `DurationScale` for that factory. If no factory can be found for -// `FactoryName`, return `None`. +// `FactoryName`, return `std::nullopt`. static llvm::Optional getScaleForFactory(llvm::StringRef FactoryName) { return llvm::StringSwitch>(FactoryName) @@ -93,7 +93,7 @@ getNewScaleSingleStep(DurationScale OldScale, double Multiplier) { } // Given the scale of a duration and a `Multiplier`, determine if `Multiplier` -// would produce a new scale. If so, return it, otherwise `None`. +// would produce a new scale. If so, return it, otherwise `std::nullopt`. static llvm::Optional getNewScale(DurationScale OldScale, double Multiplier) { while (Multiplier != 1.0) { diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp index 48000482ce240..ce012653941d4 100644 --- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp @@ -68,7 +68,7 @@ getDurationInverseForScale(DurationScale Scale) { } /// If `Node` is a call to the inverse of `Scale`, return that inverse's -/// argument, otherwise None. +/// argument, otherwise std::nullopt. static llvm::Optional rewriteInverseDurationCall(const MatchFinder::MatchResult &Result, DurationScale Scale, const Expr &Node) { @@ -87,7 +87,7 @@ rewriteInverseDurationCall(const MatchFinder::MatchResult &Result, } /// If `Node` is a call to the inverse of `Scale`, return that inverse's -/// argument, otherwise None. +/// argument, otherwise std::nullopt. static llvm::Optional rewriteInverseTimeCall(const MatchFinder::MatchResult &Result, DurationScale Scale, const Expr &Node) { diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h index 0803a7a4c0e02..14126072a12ea 100644 --- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h +++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h @@ -50,7 +50,7 @@ stripFloatCast(const ast_matchers::MatchFinder::MatchResult &Result, /// Possibly remove the fractional part of a floating point literal. /// /// If `Node` represents a floating point literal with a zero fractional part, -/// return the textual context of the integral part, otherwise `None`. +/// return the textual context of the integral part, otherwise `std::nullopt`. llvm::Optional stripFloatLiteralFraction(const ast_matchers::MatchFinder::MatchResult &Result, const Expr &Node); @@ -63,11 +63,11 @@ simplifyDurationFactoryArg(const ast_matchers::MatchFinder::MatchResult &Result, const Expr &Node); /// Given the name of an inverse Duration function (e.g., `ToDoubleSeconds`), -/// return its `DurationScale`, or `None` if a match is not found. +/// return its `DurationScale`, or `std::nullopt` if a match is not found. llvm::Optional getScaleForDurationInverse(llvm::StringRef Name); /// Given the name of an inverse Time function (e.g., `ToUnixSeconds`), -/// return its `DurationScale`, or `None` if a match is not found. +/// return its `DurationScale`, or `std::nullopt` if a match is not found. llvm::Optional getScaleForTimeInverse(llvm::StringRef Name); /// Given a `Scale` return the fully qualified inverse functions for it. diff --git a/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp index 412d0093b76b1..0c9bda79006f4 100644 --- a/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp @@ -21,9 +21,9 @@ namespace tidy { namespace readability { // Finds the location of the qualifying `const` token in the `FunctionDecl`'s -// return type. Returns `None` when the return type is not `const`-qualified or -// `const` does not appear in `Def`'s source, like when the type is an alias or -// a macro. +// return type. Returns `std::nullopt` when the return type is not +// `const`-qualified or `const` does not appear in `Def`'s source, like when the +// type is an alias or a macro. static llvm::Optional findConstToRemove(const FunctionDecl *Def, const MatchFinder::MatchResult &Result) { diff --git a/clang-tools-extra/clang-tidy/utils/LexerUtils.h b/clang-tools-extra/clang-tidy/utils/LexerUtils.h index 79ba16ded9680..b8e0f6ae2f7fc 100644 --- a/clang-tools-extra/clang-tidy/utils/LexerUtils.h +++ b/clang-tools-extra/clang-tidy/utils/LexerUtils.h @@ -99,8 +99,8 @@ bool rangeContainsExpansionsOrDirectives(SourceRange Range, /// Assuming that ``Range`` spans a CVR-qualified type, returns the /// token in ``Range`` that is responsible for the qualification. ``Range`` -/// must be valid with respect to ``SM``. Returns ``None`` if no qualifying -/// tokens are found. +/// must be valid with respect to ``SM``. Returns ``std::nullopt`` if no +/// qualifying tokens are found. /// \note: doesn't support member function qualifiers. llvm::Optional getQualifyingToken(tok::TokenKind TK, CharSourceRange Range, diff --git a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h index 38ca2011fba14..c52fce5aa8fe5 100644 --- a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h @@ -44,8 +44,8 @@ class TransformerClangTidyCheck : public ClangTidyCheck { /// \c setRule. /// /// \p MakeRule generates the rewrite rule to be used by the check, based on - /// the given language and clang-tidy options. It can return \c None to handle - /// cases where the options disable the check. + /// the given language and clang-tidy options. It can return \c std::nullopt + /// to handle cases where the options disable the check. /// /// See \c setRule for constraints on the rule. TransformerClangTidyCheck( diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index 351b3d0da0be7..c942848f769d5 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -42,7 +42,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks, /// Look for compilation databases, rather than using compile commands /// set via LSP (extensions) only. bool UseDirBasedCDB = true; - /// The offset-encoding to use, or None to negotiate it over LSP. + /// The offset-encoding to use, or std::nullopt to negotiate it over LSP. llvm::Optional Encoding; /// If set, periodically called to release memory. /// Consider malloc_trim(3) diff --git a/clang-tools-extra/clangd/Headers.h b/clang-tools-extra/clangd/Headers.h index 5611b32b11aa1..fd739845cdd84 100644 --- a/clang-tools-extra/clangd/Headers.h +++ b/clang-tools-extra/clangd/Headers.h @@ -240,8 +240,8 @@ class IncludeInserter { /// \param IncludingFile is the absolute path of the file that InsertedHeader /// will be inserted. /// - /// \return A quoted "path" or to be included, or None if it couldn't - /// be shortened. + /// \return A quoted "path" or to be included, or std::nullopt if it + /// couldn't be shortened. llvm::Optional calculateIncludePath(const HeaderFile &InsertedHeader, llvm::StringRef IncludingFile) const;