diff --git a/clang/include/clang/AST/ASTImporter.h b/clang/include/clang/AST/ASTImporter.h index f03a76bdeb443..a6bb0e8aa9506 100644 --- a/clang/include/clang/AST/ASTImporter.h +++ b/clang/include/clang/AST/ASTImporter.h @@ -577,7 +577,7 @@ class TypeSourceInfo; /// Determine the index of a field in its parent record. /// F should be a field (or indirect field) declaration. /// \returns The index of the field in its parent context (starting from 0). - /// On error `None` is returned (parent context is non-record). + /// On error `std::nullopt` is returned (parent context is non-record). static llvm::Optional getFieldIndex(Decl *F); }; diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h b/clang/include/clang/Basic/DarwinSDKInfo.h index eed7668c5218c..6a13ddd9d522e 100644 --- a/clang/include/clang/Basic/DarwinSDKInfo.h +++ b/clang/include/clang/Basic/DarwinSDKInfo.h @@ -160,8 +160,8 @@ class DarwinSDKInfo { /// Parse the SDK information from the SDKSettings.json file. /// -/// \returns an error if the SDKSettings.json file is invalid, None if the -/// SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise. +/// \returns an error if the SDKSettings.json file is invalid, std::nullopt if +/// the SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise. Expected> parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath); diff --git a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h index 7c82c8fa53b95..e20ca85fc8d6e 100644 --- a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h +++ b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h @@ -121,8 +121,8 @@ class SymbolGraphSerializer : public APISerializer { /// This method also checks if the given \p Record should be skipped during /// serialization. /// - /// \returns \c None if this \p Record should be skipped, or a JSON object - /// containing common symbol information of \p Record. + /// \returns \c std::nullopt if this \p Record should be skipped, or a JSON + /// object containing common symbol information of \p Record. template Optional serializeAPIRecord(const RecordTy &Record) const; diff --git a/clang/include/clang/Sema/Scope.h b/clang/include/clang/Sema/Scope.h index deb011892b850..f8fbc9d27a009 100644 --- a/clang/include/clang/Sema/Scope.h +++ b/clang/include/clang/Sema/Scope.h @@ -215,7 +215,7 @@ class Scope { /// 1) pointer to VarDecl that denotes NRVO candidate itself. /// 2) nullptr value means that NRVO is not allowed in this scope /// (e.g. return a function parameter). - /// 3) None value means that there is no NRVO candidate in this scope + /// 3) std::nullopt value means that there is no NRVO candidate in this scope /// (i.e. there are no return statements in this scope). Optional NRVO; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h index a4fa3fbf45dbe..adc3af9e775b9 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h @@ -235,7 +235,7 @@ class SValBuilder { /// Returns the value of \p E, if it can be determined in a non-path-sensitive /// manner. /// - /// If \p E is not a constant or cannot be modeled, returns \c None. + /// If \p E is not a constant or cannot be modeled, returns \c std::nullopt. Optional getConstantVal(const Expr *E); NonLoc makeCompoundVal(QualType type, llvm::ImmutableList vals) { diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h index 2ef083aa16467..80db6bf5667e4 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h @@ -173,7 +173,7 @@ class StoreManager { /// - We don't know (base is a symbolic region and we don't have /// enough info to determine if the cast will succeed at run time). /// The function returns an optional with SVal representing the derived class - /// in case of a successful cast and `None` otherwise. + /// in case of a successful cast and `std::nullopt` otherwise. Optional evalBaseToDerived(SVal Base, QualType DerivedPtrType); const ElementRegion *GetElementZeroRegion(const SubRegion *R, QualType T); diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 59c359a19de27..961410c5b53ed 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -372,7 +372,7 @@ static const Expr *findWeakLValue(const Expr *E) { /// /// If the runtime does support a required entrypoint, then this method will /// generate a call and return the resulting value. Otherwise it will return -/// None and the caller can generate a msgSend instead. +/// std::nullopt and the caller can generate a msgSend instead. static Optional tryGenerateSpecializedMessageSend(CodeGenFunction &CGF, QualType ResultType, llvm::Value *Receiver, diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index 46c4092cfce94..99f962bba7f5f 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -200,8 +200,8 @@ class FileHandler { virtual Error ReadHeader(MemoryBuffer &Input) = 0; /// Read the marker of the next bundled to be read in the file. The bundle - /// name is returned if there is one in the file, or `None` if there are no - /// more bundles to be read. + /// name is returned if there is one in the file, or `std::nullopt` if there + /// are no more bundles to be read. virtual Expected> ReadBundleStart(MemoryBuffer &Input) = 0; diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 86c345013fde3..06b97a10c6a76 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -124,7 +124,7 @@ static void handleHVXTargetFeatures(const Driver &D, const ArgList &Args, [&](auto FlagOn, auto FlagOff, unsigned MinVerNum) -> std::optional { // Return an std::optional: - // - None indicates a verification failure, or that the flag was not + // - std::nullopt indicates a verification failure, or that the flag was not // present in Args. // - Otherwise the returned value is that name of the feature to add // to Features. diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp index 91dc2529a4b4f..cea4d91a84d50 100644 --- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp +++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp @@ -56,8 +56,8 @@ void serializeArray(Object &Paren, StringRef Key, Optional Array) { /// } /// \endcode /// -/// \returns \c None if the version \p V is empty, or an \c Object containing -/// the semantic version representation of \p V. +/// \returns \c std::nullopt if the version \p V is empty, or an \c Object +/// containing the semantic version representation of \p V. Optional serializeSemanticVersion(const VersionTuple &V) { if (V.empty()) return std::nullopt; @@ -142,8 +142,8 @@ Object serializeSourceRange(const PresumedLoc &BeginLoc, /// or deprecated, i.e. \c __attribute__((unavailable)) and \c /// __attribute__((deprecated)). /// -/// \returns \c None if the symbol has default availability attributes, or -/// an \c Array containing the formatted availability information. +/// \returns \c std::nullopt if the symbol has default availability attributes, +/// or an \c Array containing the formatted availability information. Optional serializeAvailability(const AvailabilitySet &Availabilities) { if (Availabilities.isDefault()) return std::nullopt; @@ -228,8 +228,8 @@ Object serializeIdentifier(const APIRecord &Record, Language Lang) { /// ^~~~~~~~~~~~~~~~~~~~~~~' Second line. /// \endcode /// -/// \returns \c None if \p Comment is empty, or an \c Object containing the -/// formatted lines. +/// \returns \c std::nullopt if \p Comment is empty, or an \c Object containing +/// the formatted lines. Optional serializeDocComment(const DocComment &Comment) { if (Comment.empty()) return std::nullopt; @@ -280,8 +280,8 @@ Optional serializeDocComment(const DocComment &Comment) { /// ] /// \endcode /// -/// \returns \c None if \p DF is empty, or an \c Array containing the formatted -/// declaration fragments array. +/// \returns \c std::nullopt if \p DF is empty, or an \c Array containing the +/// formatted declaration fragments array. Optional serializeDeclarationFragments(const DeclarationFragments &DF) { if (DF.getFragments().empty()) return std::nullopt; @@ -447,7 +447,7 @@ Optional serializeFunctionSignatureMixinImpl(const RecordTy &Record, /// - The \c parameters array contains names and declaration fragments of the /// parameters. /// -/// \returns \c None if \p FS is empty, or an \c Object containing the +/// \returns \c std::nullopt if \p FS is empty, or an \c Object containing the /// formatted function signature. template void serializeFunctionSignatureMixin(Object &Paren, const RecordTy &Record) { diff --git a/clang/lib/Lex/DependencyDirectivesScanner.cpp b/clang/lib/Lex/DependencyDirectivesScanner.cpp index 8d33e19f5df0e..a709847a83892 100644 --- a/clang/lib/Lex/DependencyDirectivesScanner.cpp +++ b/clang/lib/Lex/DependencyDirectivesScanner.cpp @@ -91,7 +91,7 @@ struct Scanner { void skipDirective(StringRef Name, const char *&First, const char *const End); /// Lexes next token and if it is identifier returns its string, otherwise - /// it skips the current line and returns \p None. + /// it skips the current line and returns \p std::nullopt. /// /// In any case (whatever the token kind) \p First and the \p Lexer will /// advance beyond the token. diff --git a/clang/lib/Sema/SemaAvailability.cpp b/clang/lib/Sema/SemaAvailability.cpp index 3a5399a7175fa..b0e99da9dd5f7 100644 --- a/clang/lib/Sema/SemaAvailability.cpp +++ b/clang/lib/Sema/SemaAvailability.cpp @@ -244,8 +244,8 @@ struct AttributeInsertion { /// attribute argument. /// \param SlotNames The vector that will be populated with slot names. In case /// of unsuccessful parsing can contain invalid data. -/// \returns A number of method parameters if parsing was successful, None -/// otherwise. +/// \returns A number of method parameters if parsing was successful, +/// std::nullopt otherwise. static Optional tryParseObjCMethodName(StringRef Name, SmallVectorImpl &SlotNames, const LangOptions &LangOpts) { diff --git a/clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h b/clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h index d46a403d59a54..7d87743f8c33f 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h +++ b/clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h @@ -49,8 +49,8 @@ llvm::Optional getErrnoValue(ProgramStateRef State); ErrnoCheckState getErrnoState(ProgramStateRef State); /// Returns the location that points to the \c MemoryRegion where the 'errno' -/// value is stored. Returns \c None if 'errno' was not found. Otherwise it -/// always returns a valid memory region in the system global memory space. +/// value is stored. Returns \c std::nullopt if 'errno' was not found. Otherwise +/// it always returns a valid memory region in the system global memory space. llvm::Optional getErrnoLoc(ProgramStateRef State); /// Set value of 'errno' to any SVal, if possible. diff --git a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp index 800e6791f028a..216390a15c25d 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp @@ -121,7 +121,7 @@ struct DereferenceInfo { /// Dereferences \p FR and returns with the pointee's region, and whether it /// needs to be casted back to it's location type. If for whatever reason -/// dereferencing fails, returns with None. +/// dereferencing fails, returns std::nullopt. static llvm::Optional dereference(ProgramStateRef State, const FieldRegion *FR); diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h index 753adea0d14d3..e10ee4ae7a145 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h @@ -26,11 +26,11 @@ class Type; // Ref. /// \returns CXXRecordDecl of the base if the type is ref-countable, nullptr if -/// not, None if inconclusive. +/// not, std::nullopt if inconclusive. llvm::Optional isRefCountable(const clang::CXXBaseSpecifier *Base); -/// \returns true if \p Class is ref-countable, false if not, None if +/// \returns true if \p Class is ref-countable, false if not, std::nullopt if /// inconclusive. llvm::Optional isRefCountable(const clang::CXXRecordDecl *Class); @@ -38,11 +38,11 @@ llvm::Optional isRefCountable(const clang::CXXRecordDecl *Class); bool isRefCounted(const clang::CXXRecordDecl *Class); /// \returns true if \p Class is ref-countable AND not ref-counted, false if -/// not, None if inconclusive. +/// not, std::nullopt if inconclusive. llvm::Optional isUncounted(const clang::CXXRecordDecl *Class); /// \returns true if \p T is either a raw pointer or reference to an uncounted -/// class, false if not, None if inconclusive. +/// class, false if not, std::nullopt if inconclusive. llvm::Optional isUncountedPtr(const clang::Type *T); /// \returns true if \p F creates ref-countable object from uncounted parameter, diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 6d6ee55917966..f5959b26dd92c 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -483,8 +483,8 @@ class RegionStoreManager : public StoreManager { /// than using a Default binding at the base of the entire region. This is a /// heuristic attempting to avoid building long chains of LazyCompoundVals. /// - /// \returns The updated store bindings, or \c None if binding non-lazily - /// would be too expensive. + /// \returns The updated store bindings, or \c std::nullopt if binding + /// non-lazily would be too expensive. Optional tryBindSmallStruct(RegionBindingsConstRef B, const TypedValueRegion *R, const RecordDecl *RD, @@ -1665,7 +1665,7 @@ getElementRegionOffsetsWithBase(const ElementRegion *ER) { /// \param ArrayExtents [in] The array of extents. /// \param DstOffsets [out] The array of offsets of type `uint64_t`. /// \returns: -/// - `None` for successful convertion. +/// - `std::nullopt` for successful convertion. /// - `UndefinedVal` or `UnknownVal` otherwise. It's expected that this SVal /// will be returned as a suitable value of the access operation. /// which should be returned as a correct