[clang] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. 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
This commit is contained in:
parent
0c2f6e36f9
commit
5891420e68
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
llvm::Optional<bool> isSwiftPrivate() const {
|
||||
return SwiftPrivateSpecified ? llvm::Optional<bool>(SwiftPrivate)
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
void setSwiftPrivate(llvm::Optional<bool> Private) {
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
void setSwiftBridge(const llvm::Optional<llvm::StringRef> &SwiftType) {
|
||||
SwiftBridge = SwiftType
|
||||
? llvm::Optional<std::string>(std::string(*SwiftType))
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
const llvm::Optional<std::string> &getNSErrorDomain() const {
|
||||
|
@ -158,8 +158,8 @@ public:
|
|||
}
|
||||
|
||||
void setNSErrorDomain(const llvm::Optional<llvm::StringRef> &Domain) {
|
||||
NSErrorDomain =
|
||||
Domain ? llvm::Optional<std::string>(std::string(*Domain)) : llvm::None;
|
||||
NSErrorDomain = Domain ? llvm::Optional<std::string>(std::string(*Domain))
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
friend bool operator==(const CommonTypeInfo &, const CommonTypeInfo &);
|
||||
|
@ -220,7 +220,7 @@ public:
|
|||
return HasDefaultNullability
|
||||
? llvm::Optional<NullabilityKind>(
|
||||
static_cast<NullabilityKind>(DefaultNullability))
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
/// Set the default nullability for properties and methods of this class.
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
llvm::Optional<bool> getSwiftImportAsNonGeneric() const {
|
||||
return SwiftImportAsNonGenericSpecified
|
||||
? llvm::Optional<bool>(SwiftImportAsNonGeneric)
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
void setSwiftImportAsNonGeneric(llvm::Optional<bool> Value) {
|
||||
SwiftImportAsNonGenericSpecified = Value.has_value();
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
|
||||
llvm::Optional<bool> getSwiftObjCMembers() const {
|
||||
return SwiftObjCMembersSpecified ? llvm::Optional<bool>(SwiftObjCMembers)
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
void setSwiftObjCMembers(llvm::Optional<bool> Value) {
|
||||
SwiftObjCMembersSpecified = Value.has_value();
|
||||
|
@ -313,7 +313,7 @@ public:
|
|||
llvm::Optional<NullabilityKind> getNullability() const {
|
||||
return NullabilityAudited ? llvm::Optional<NullabilityKind>(
|
||||
static_cast<NullabilityKind>(Nullable))
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
void setNullabilityAudited(NullabilityKind kind) {
|
||||
|
@ -362,7 +362,7 @@ public:
|
|||
llvm::Optional<bool> getSwiftImportAsAccessors() const {
|
||||
return SwiftImportAsAccessorsSpecified
|
||||
? llvm::Optional<bool>(SwiftImportAsAccessors)
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
void setSwiftImportAsAccessors(llvm::Optional<bool> Value) {
|
||||
SwiftImportAsAccessorsSpecified = Value.has_value();
|
||||
|
@ -425,7 +425,7 @@ public:
|
|||
|
||||
llvm::Optional<bool> isNoEscape() const {
|
||||
if (!NoEscapeSpecified)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return NoEscape;
|
||||
}
|
||||
void setNoEscape(llvm::Optional<bool> Value) {
|
||||
|
@ -435,7 +435,7 @@ public:
|
|||
|
||||
llvm::Optional<RetainCountConventionKind> getRetainCountConvention() const {
|
||||
if (!RawRetainCountConvention)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
|
||||
}
|
||||
void
|
||||
|
@ -553,7 +553,7 @@ public:
|
|||
|
||||
llvm::Optional<RetainCountConventionKind> getRetainCountConvention() const {
|
||||
if (!RawRetainCountConvention)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
|
||||
}
|
||||
void
|
||||
|
@ -661,7 +661,7 @@ public:
|
|||
llvm::Optional<bool> isFlagEnum() const {
|
||||
if (HasFlagEnum)
|
||||
return IsFlagEnum;
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
void setFlagEnum(llvm::Optional<bool> Value) {
|
||||
HasFlagEnum = Value.has_value();
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
}
|
||||
|
||||
llvm::Optional<TraversalKind> getCheckTraversalKind() const override {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
SmallVector<BoundNodes, 1> Nodes;
|
||||
|
|
|
@ -122,7 +122,7 @@ template <typename T> struct TypeListContainsSuperOf<EmptyTypeList, T> {
|
|||
template <typename ResultT, typename ArgT,
|
||||
ResultT (*Func)(ArrayRef<const ArgT *>)>
|
||||
struct VariadicFunction {
|
||||
ResultT operator()() const { return Func(None); }
|
||||
ResultT operator()() const { return Func(std::nullopt); }
|
||||
|
||||
template <typename... ArgsT>
|
||||
ResultT operator()(const ArgT &Arg1, const ArgsT &... Args) const {
|
||||
|
@ -352,7 +352,7 @@ public:
|
|||
BoundNodesTreeBuilder *Builder) const = 0;
|
||||
|
||||
virtual llvm::Optional<clang::TraversalKind> TraversalKind() const {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1983,10 +1983,10 @@ template <>
|
|||
inline Optional<BinaryOperatorKind>
|
||||
equivalentBinaryOperator<CXXOperatorCallExpr>(const CXXOperatorCallExpr &Node) {
|
||||
if (Node.getNumArgs() != 2)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
switch (Node.getOperator()) {
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case OO_ArrowStar:
|
||||
return BO_PtrMemI;
|
||||
case OO_Star:
|
||||
|
@ -2065,10 +2065,10 @@ inline Optional<UnaryOperatorKind>
|
|||
equivalentUnaryOperator<CXXOperatorCallExpr>(const CXXOperatorCallExpr &Node) {
|
||||
if (Node.getNumArgs() != 1 && Node.getOperator() != OO_PlusPlus &&
|
||||
Node.getOperator() != OO_MinusMinus)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
switch (Node.getOperator()) {
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case OO_Plus:
|
||||
return UO_Plus;
|
||||
case OO_Minus:
|
||||
|
@ -2084,13 +2084,13 @@ equivalentUnaryOperator<CXXOperatorCallExpr>(const CXXOperatorCallExpr &Node) {
|
|||
case OO_PlusPlus: {
|
||||
const auto *FD = Node.getDirectCallee();
|
||||
if (!FD)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return FD->getNumParams() > 0 ? UO_PostInc : UO_PreInc;
|
||||
}
|
||||
case OO_MinusMinus: {
|
||||
const auto *FD = Node.getDirectCallee();
|
||||
if (!FD)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return FD->getNumParams() > 0 ? UO_PostDec : UO_PreDec;
|
||||
}
|
||||
case OO_Coawait:
|
||||
|
@ -2191,7 +2191,7 @@ inline Optional<StringRef> getOpName(const CXXOperatorCallExpr &Node) {
|
|||
if (!optBinaryOpcode) {
|
||||
auto optUnaryOpcode = equivalentUnaryOperator(Node);
|
||||
if (!optUnaryOpcode)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return UnaryOperator::getOpcodeStr(*optUnaryOpcode);
|
||||
}
|
||||
return BinaryOperator::getOpcodeStr(*optBinaryOpcode);
|
||||
|
@ -2236,7 +2236,7 @@ private:
|
|||
if (!optBinaryOpcode) {
|
||||
auto optUnaryOpcode = equivalentUnaryOperator(Node);
|
||||
if (!optUnaryOpcode)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return UnaryOperator::getOpcodeStr(*optUnaryOpcode);
|
||||
}
|
||||
return BinaryOperator::getOpcodeStr(*optBinaryOpcode);
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
Command(const Action &Source, const Tool &Creator,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments, ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs = None);
|
||||
ArrayRef<InputInfo> Outputs = std::nullopt);
|
||||
// FIXME: This really shouldn't be copyable, but is currently copied in some
|
||||
// error handling in Driver::generateCompilationDiagnostics.
|
||||
Command(const Command &) = default;
|
||||
|
@ -241,7 +241,8 @@ public:
|
|||
CC1Command(const Action &Source, const Tool &Creator,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments,
|
||||
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs = None);
|
||||
ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs = std::nullopt);
|
||||
|
||||
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
|
||||
CrashReportInfo *CrashInfo = nullptr) const override;
|
||||
|
@ -260,7 +261,7 @@ public:
|
|||
const char *Executable_,
|
||||
const llvm::opt::ArgStringList &Arguments_,
|
||||
ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs = None);
|
||||
ArrayRef<InputInfo> Outputs = std::nullopt);
|
||||
|
||||
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
|
||||
CrashReportInfo *CrashInfo = nullptr) const override;
|
||||
|
|
|
@ -823,7 +823,7 @@ public:
|
|||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags, StringRef ResourceFilesPath,
|
||||
bool OnlyLocalDecls = false,
|
||||
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
|
||||
ArrayRef<RemappedFile> RemappedFiles = None,
|
||||
ArrayRef<RemappedFile> RemappedFiles = std::nullopt,
|
||||
bool RemappedFilesKeepOriginalName = true,
|
||||
unsigned PrecompilePreambleAfterNParses = 0,
|
||||
TranslationUnitKind TUKind = TU_Complete,
|
||||
|
@ -835,7 +835,7 @@ public:
|
|||
bool SingleFileParse = false, bool UserFilesAreVolatile = false,
|
||||
bool ForSerialization = false,
|
||||
bool RetainExcludedConditionalBlocks = false,
|
||||
llvm::Optional<StringRef> ModuleFormat = llvm::None,
|
||||
llvm::Optional<StringRef> ModuleFormat = std::nullopt,
|
||||
std::unique_ptr<ASTUnit> *ErrAST = nullptr,
|
||||
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
|
||||
|
||||
|
@ -851,7 +851,7 @@ public:
|
|||
/// \returns True if a failure occurred that causes the ASTUnit not to
|
||||
/// contain any translation-unit information, false otherwise.
|
||||
bool Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
|
||||
ArrayRef<RemappedFile> RemappedFiles = None,
|
||||
ArrayRef<RemappedFile> RemappedFiles = std::nullopt,
|
||||
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
|
||||
|
||||
/// Free data that will be re-generated on the next parse.
|
||||
|
|
|
@ -93,7 +93,7 @@ struct ParsedSourceRange {
|
|||
}
|
||||
auto Begin = ParsedSourceLocation::FromString(RangeSplit.first);
|
||||
if (Begin.FileName.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
if (!HasEndLoc) {
|
||||
EndLine = Begin.Line;
|
||||
EndColumn = Begin.Column;
|
||||
|
|
|
@ -241,9 +241,9 @@ public:
|
|||
InputKind getKind() const { return Kind; }
|
||||
bool isSystem() const { return IsSystem; }
|
||||
|
||||
bool isEmpty() const { return File.empty() && Buffer == None; }
|
||||
bool isEmpty() const { return File.empty() && Buffer == std::nullopt; }
|
||||
bool isFile() const { return !isBuffer(); }
|
||||
bool isBuffer() const { return Buffer != None; }
|
||||
bool isBuffer() const { return Buffer != std::nullopt; }
|
||||
bool isPreprocessed() const { return Kind.isPreprocessed(); }
|
||||
bool isHeader() const { return Kind.isHeader(); }
|
||||
InputKind::HeaderUnitKind getHeaderUnitKind() const {
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
}
|
||||
|
||||
Optional<DirectoryEntryRef> getDirRef() const {
|
||||
return isNormalDir() ? Optional<DirectoryEntryRef>(u.Dir) : None;
|
||||
return isNormalDir() ? Optional<DirectoryEntryRef>(u.Dir) : std::nullopt;
|
||||
}
|
||||
|
||||
/// getFrameworkDir - Return the directory that this framework refers to.
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
}
|
||||
|
||||
Optional<DirectoryEntryRef> getFrameworkDirRef() const {
|
||||
return isFramework() ? Optional<DirectoryEntryRef>(u.Dir) : None;
|
||||
return isFramework() ? Optional<DirectoryEntryRef>(u.Dir) : std::nullopt;
|
||||
}
|
||||
|
||||
/// getHeaderMap - Return the directory that this entry refers to.
|
||||
|
|
|
@ -735,7 +735,7 @@ public:
|
|||
llvm::Optional<Module *> getCachedModuleLoad(const IdentifierInfo &II) {
|
||||
auto I = CachedModuleLoads.find(&II);
|
||||
if (I == CachedModuleLoads.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return I->second;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -293,7 +293,7 @@ class Token;
|
|||
/// entity with index \p Index came from file \p FID.
|
||||
virtual Optional<bool> isPreprocessedEntityInFileID(unsigned Index,
|
||||
FileID FID) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Read a preallocated skipped range from the external source.
|
||||
|
|
|
@ -757,7 +757,7 @@ private:
|
|||
getActiveModuleMacros(Preprocessor &PP, const IdentifierInfo *II) const {
|
||||
if (auto *Info = getModuleInfo(PP, II))
|
||||
return Info->ActiveModuleMacros;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
|
||||
|
@ -781,7 +781,7 @@ private:
|
|||
ArrayRef<ModuleMacro*> getOverriddenMacros() const {
|
||||
if (auto *Info = State.dyn_cast<ModuleMacroInfo*>())
|
||||
return Info->OverriddenMacros;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void setOverriddenMacros(Preprocessor &PP,
|
||||
|
@ -904,17 +904,17 @@ private:
|
|||
static MacroAnnotations makeDeprecation(SourceLocation Loc,
|
||||
std::string Msg) {
|
||||
return MacroAnnotations{MacroAnnotationInfo{Loc, std::move(Msg)},
|
||||
llvm::None, llvm::None};
|
||||
std::nullopt, std::nullopt};
|
||||
}
|
||||
|
||||
static MacroAnnotations makeRestrictExpansion(SourceLocation Loc,
|
||||
std::string Msg) {
|
||||
return MacroAnnotations{
|
||||
llvm::None, MacroAnnotationInfo{Loc, std::move(Msg)}, llvm::None};
|
||||
std::nullopt, MacroAnnotationInfo{Loc, std::move(Msg)}, std::nullopt};
|
||||
}
|
||||
|
||||
static MacroAnnotations makeFinal(SourceLocation Loc) {
|
||||
return MacroAnnotations{llvm::None, llvm::None, Loc};
|
||||
return MacroAnnotations{std::nullopt, std::nullopt, Loc};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ public:
|
|||
auto I = LeafModuleMacros.find(II);
|
||||
if (I != LeafModuleMacros.end())
|
||||
return I->second;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Get the list of submodules that we're currently building.
|
||||
|
|
|
@ -3066,7 +3066,8 @@ private:
|
|||
void ParseTypeQualifierListOpt(
|
||||
DeclSpec &DS, unsigned AttrReqs = AR_AllAttributesParsed,
|
||||
bool AtomicAllowed = true, bool IdentifierRequired = false,
|
||||
Optional<llvm::function_ref<void()>> CodeCompletionHandler = None);
|
||||
Optional<llvm::function_ref<void()>> CodeCompletionHandler =
|
||||
std::nullopt);
|
||||
void ParseDirectDeclarator(Declarator &D);
|
||||
void ParseDecompositionDeclarator(Declarator &D);
|
||||
void ParseParenDeclarator(Declarator &D);
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
OptionalFileEntryRefDegradesToFileEntryPtr getFile() const {
|
||||
if (auto *P = Val.getPointer())
|
||||
return FileEntryRef(*P);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
bool isOverridden() const { return Val.getInt() == Overridden; }
|
||||
bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
return ArrayRef<dependency_directives_scan::Directive>(
|
||||
Directives->value());
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// \returns The error.
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
/// occurred, dependency file contents otherwise.
|
||||
llvm::Expected<std::string>
|
||||
getDependencyFile(const std::vector<std::string> &CommandLine, StringRef CWD,
|
||||
llvm::Optional<StringRef> ModuleName = None);
|
||||
llvm::Optional<StringRef> ModuleName = std::nullopt);
|
||||
|
||||
/// Collect the full module dependency graph for the input, ignoring any
|
||||
/// modules which have already been seen. If \p ModuleName isn't empty, this
|
||||
|
@ -105,13 +105,13 @@ public:
|
|||
getFullDependencies(const std::vector<std::string> &CommandLine,
|
||||
StringRef CWD, const llvm::StringSet<> &AlreadySeen,
|
||||
LookupModuleOutputCallback LookupModuleOutput,
|
||||
llvm::Optional<StringRef> ModuleName = None);
|
||||
llvm::Optional<StringRef> ModuleName = std::nullopt);
|
||||
|
||||
llvm::Expected<FullDependenciesResult> getFullDependenciesLegacyDriverCommand(
|
||||
const std::vector<std::string> &CommandLine, StringRef CWD,
|
||||
const llvm::StringSet<> &AlreadySeen,
|
||||
LookupModuleOutputCallback LookupModuleOutput,
|
||||
llvm::Optional<StringRef> ModuleName = None);
|
||||
llvm::Optional<StringRef> ModuleName = std::nullopt);
|
||||
|
||||
private:
|
||||
DependencyScanningWorker Worker;
|
||||
|
|
|
@ -79,13 +79,14 @@ public:
|
|||
const std::vector<std::string> &CommandLine,
|
||||
DependencyConsumer &DepConsumer,
|
||||
DiagnosticConsumer &DiagConsumer,
|
||||
llvm::Optional<StringRef> ModuleName = None);
|
||||
llvm::Optional<StringRef> ModuleName = std::nullopt);
|
||||
/// \returns A \c StringError with the diagnostic output if clang errors
|
||||
/// occurred, success otherwise.
|
||||
llvm::Error computeDependencies(StringRef WorkingDirectory,
|
||||
const std::vector<std::string> &CommandLine,
|
||||
DependencyConsumer &Consumer,
|
||||
llvm::Optional<StringRef> ModuleName = None);
|
||||
llvm::Error
|
||||
computeDependencies(StringRef WorkingDirectory,
|
||||
const std::vector<std::string> &CommandLine,
|
||||
DependencyConsumer &Consumer,
|
||||
llvm::Optional<StringRef> ModuleName = std::nullopt);
|
||||
|
||||
bool shouldEagerLoadModules() const { return EagerLoadModules; }
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ template <> struct ScalarEnumerationTraits<RetainCountConventionKind> {
|
|||
template <> struct MappingTraits<Param> {
|
||||
static void mapping(IO &IO, Param &P) {
|
||||
IO.mapRequired("Position", P.Position);
|
||||
IO.mapOptional("Nullability", P.Nullability, llvm::None);
|
||||
IO.mapOptional("Nullability", P.Nullability, std::nullopt);
|
||||
IO.mapOptional("RetainCountConvention", P.RetainCountConvention);
|
||||
IO.mapOptional("NoEscape", P.NoEscape);
|
||||
IO.mapOptional("Type", P.Type, StringRef(""));
|
||||
|
@ -183,7 +183,7 @@ template <> struct MappingTraits<Method> {
|
|||
IO.mapRequired("MethodKind", M.Kind);
|
||||
IO.mapOptional("Parameters", M.Params);
|
||||
IO.mapOptional("Nullability", M.Nullability);
|
||||
IO.mapOptional("NullabilityOfRet", M.NullabilityOfRet, llvm::None);
|
||||
IO.mapOptional("NullabilityOfRet", M.NullabilityOfRet, std::nullopt);
|
||||
IO.mapOptional("RetainCountConvention", M.RetainCountConvention);
|
||||
IO.mapOptional("Availability", M.Availability.Mode,
|
||||
APIAvailability::Available);
|
||||
|
@ -222,7 +222,7 @@ template <> struct MappingTraits<Property> {
|
|||
static void mapping(IO &IO, Property &P) {
|
||||
IO.mapRequired("Name", P.Name);
|
||||
IO.mapOptional("PropertyKind", P.Kind);
|
||||
IO.mapOptional("Nullability", P.Nullability, llvm::None);
|
||||
IO.mapOptional("Nullability", P.Nullability, std::nullopt);
|
||||
IO.mapOptional("Availability", P.Availability.Mode,
|
||||
APIAvailability::Available);
|
||||
IO.mapOptional("AvailabilityMsg", P.Availability.Msg, StringRef(""));
|
||||
|
@ -303,7 +303,7 @@ template <> struct MappingTraits<Function> {
|
|||
IO.mapRequired("Name", F.Name);
|
||||
IO.mapOptional("Parameters", F.Params);
|
||||
IO.mapOptional("Nullability", F.Nullability);
|
||||
IO.mapOptional("NullabilityOfRet", F.NullabilityOfRet, llvm::None);
|
||||
IO.mapOptional("NullabilityOfRet", F.NullabilityOfRet, std::nullopt);
|
||||
IO.mapOptional("RetainCountConvention", F.RetainCountConvention);
|
||||
IO.mapOptional("Availability", F.Availability.Mode,
|
||||
APIAvailability::Available);
|
||||
|
@ -336,7 +336,7 @@ namespace yaml {
|
|||
template <> struct MappingTraits<GlobalVariable> {
|
||||
static void mapping(IO &IO, GlobalVariable &GV) {
|
||||
IO.mapRequired("Name", GV.Name);
|
||||
IO.mapOptional("Nullability", GV.Nullability, llvm::None);
|
||||
IO.mapOptional("Nullability", GV.Nullability, std::nullopt);
|
||||
IO.mapOptional("Availability", GV.Availability.Mode,
|
||||
APIAvailability::Available);
|
||||
IO.mapOptional("AvailabilityMsg", GV.Availability.Msg, StringRef(""));
|
||||
|
@ -549,7 +549,7 @@ struct Module {
|
|||
TopLevelItems TopLevel;
|
||||
VersionedSeq SwiftVersions;
|
||||
|
||||
llvm::Optional<bool> SwiftInferImportAsMember = {llvm::None};
|
||||
llvm::Optional<bool> SwiftInferImportAsMember = {std::nullopt};
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
LLVM_DUMP_METHOD void dump() /*const*/;
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
bool clearDiagnostic(ArrayRef<unsigned> IDs, SourceRange range);
|
||||
bool clearAllDiagnostics(SourceRange range) {
|
||||
return clearDiagnostic(None, range);
|
||||
return clearDiagnostic(std::nullopt, range);
|
||||
}
|
||||
bool clearDiagnostic(unsigned ID1, unsigned ID2, SourceRange range) {
|
||||
unsigned IDs[] = { ID1, ID2 };
|
||||
|
|
|
@ -202,7 +202,7 @@ ObjCMigrateAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
|
|||
Consumers.push_back(WrapperFrontendAction::CreateASTConsumer(CI, InFile));
|
||||
Consumers.push_back(std::make_unique<ObjCMigrateASTConsumer>(
|
||||
MigrateDir, ObjCMigAction, Remapper, CompInst->getFileManager(), PPRec,
|
||||
CompInst->getPreprocessor(), false, None));
|
||||
CompInst->getPreprocessor(), false, std::nullopt));
|
||||
return std::make_unique<MultiplexConsumer>(std::move(Consumers));
|
||||
}
|
||||
|
||||
|
|
|
@ -1687,7 +1687,7 @@ StringRef MatchFinder::MatchCallback::getID() const { return "<unknown>"; }
|
|||
|
||||
llvm::Optional<TraversalKind>
|
||||
MatchFinder::MatchCallback::getCheckTraversalKind() const {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // end namespace ast_matchers
|
||||
|
|
|
@ -340,7 +340,8 @@ bool DynTypedMatcher::matchesNoKindCheck(const DynTypedNode &DynNode,
|
|||
}
|
||||
|
||||
llvm::Optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const {
|
||||
if (!AllowBind) return llvm::None;
|
||||
if (!AllowBind)
|
||||
return std::nullopt;
|
||||
auto Result = *this;
|
||||
Result.Implementation =
|
||||
new IdDynMatcher(ID, std::move(Result.Implementation));
|
||||
|
@ -703,7 +704,7 @@ getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc,
|
|||
if (isTokenAtLoc(SM, LangOpts, MacroName, Loc))
|
||||
return Loc;
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
|
||||
|
|
|
@ -56,7 +56,7 @@ getBestGuess(llvm::StringRef Search, llvm::ArrayRef<llvm::StringRef> Allowed,
|
|||
if (!Res.empty())
|
||||
return Res.str();
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<std::string>
|
||||
|
@ -69,7 +69,7 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
if (Value.isString())
|
||||
return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed),
|
||||
"attr::");
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<std::string>
|
||||
|
@ -82,7 +82,7 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
if (Value.isString())
|
||||
return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed),
|
||||
"CK_");
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<std::string>
|
||||
|
@ -96,7 +96,7 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
if (Value.isString())
|
||||
return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed),
|
||||
"OMPC_");
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<std::string>
|
||||
|
@ -110,7 +110,7 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
if (Value.isString())
|
||||
return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed),
|
||||
"UETT_");
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static constexpr std::pair<llvm::StringRef, llvm::Regex::RegexFlags>
|
||||
|
@ -127,7 +127,7 @@ getRegexFlag(llvm::StringRef Flag) {
|
|||
if (Flag == StringFlag.first)
|
||||
return StringFlag.second;
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static llvm::Optional<llvm::StringRef>
|
||||
|
@ -136,7 +136,7 @@ getCloseRegexMatch(llvm::StringRef Flag) {
|
|||
if (Flag.edit_distance(StringFlag.first) < 3)
|
||||
return StringFlag.first;
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<llvm::Regex::RegexFlags>
|
||||
|
@ -150,7 +150,7 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
getRegexFlag(OrFlag.trim()))
|
||||
Flag = Flag.value_or(llvm::Regex::NoFlags) | *NextFlag;
|
||||
else
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ llvm::Optional<std::string>
|
|||
clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
||||
llvm::Regex::RegexFlags>::getBestGuess(const VariantValue &Value) {
|
||||
if (!Value.isString())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
SmallVector<StringRef, 4> Split;
|
||||
llvm::StringRef(Value.getString()).split(Split, '|', -1, false);
|
||||
for (llvm::StringRef &Flag : Split) {
|
||||
|
@ -167,9 +167,9 @@ clang::ast_matchers::dynamic::internal::ArgTypeTraits<
|
|||
getCloseRegexMatch(Flag.trim()))
|
||||
Flag = *BestGuess;
|
||||
else
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
if (Split.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return llvm::join(Split, " | ");
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ template <> struct ArgTypeTraits<std::string> {
|
|||
}
|
||||
|
||||
static llvm::Optional<std::string> getBestGuess(const VariantValue &) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ template <class T> struct ArgTypeTraits<ast_matchers::internal::Matcher<T>> {
|
|||
}
|
||||
|
||||
static llvm::Optional<std::string> getBestGuess(const VariantValue &) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -116,7 +116,7 @@ template <> struct ArgTypeTraits<bool> {
|
|||
}
|
||||
|
||||
static llvm::Optional<std::string> getBestGuess(const VariantValue &) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -135,7 +135,7 @@ template <> struct ArgTypeTraits<double> {
|
|||
}
|
||||
|
||||
static llvm::Optional<std::string> getBestGuess(const VariantValue &) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -154,7 +154,7 @@ template <> struct ArgTypeTraits<unsigned> {
|
|||
}
|
||||
|
||||
static llvm::Optional<std::string> getBestGuess(const VariantValue &) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -162,11 +162,11 @@ template <> struct ArgTypeTraits<attr::Kind> {
|
|||
private:
|
||||
static Optional<attr::Kind> getAttrKind(llvm::StringRef AttrKind) {
|
||||
if (!AttrKind.consume_front("attr::"))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return llvm::StringSwitch<Optional<attr::Kind>>(AttrKind)
|
||||
#define ATTR(X) .Case(#X, attr::X)
|
||||
#include "clang/Basic/AttrList.inc"
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -192,11 +192,11 @@ template <> struct ArgTypeTraits<CastKind> {
|
|||
private:
|
||||
static Optional<CastKind> getCastKind(llvm::StringRef AttrKind) {
|
||||
if (!AttrKind.consume_front("CK_"))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return llvm::StringSwitch<Optional<CastKind>>(AttrKind)
|
||||
#define CAST_OPERATION(Name) .Case(#Name, CK_##Name)
|
||||
#include "clang/AST/OperationKinds.def"
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -246,7 +246,7 @@ private:
|
|||
#define GEN_CLANG_CLAUSE_CLASS
|
||||
#define CLAUSE_CLASS(Enum, Str, Class) .Case(#Enum, llvm::omp::Clause::Enum)
|
||||
#include "llvm/Frontend/OpenMP/OMP.inc"
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -271,13 +271,13 @@ private:
|
|||
static Optional<UnaryExprOrTypeTrait>
|
||||
getUnaryOrTypeTraitKind(llvm::StringRef ClauseKind) {
|
||||
if (!ClauseKind.consume_front("UETT_"))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return llvm::StringSwitch<Optional<UnaryExprOrTypeTrait>>(ClauseKind)
|
||||
#define UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) .Case(#Name, UETT_##Name)
|
||||
#define CXX11_UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) \
|
||||
.Case(#Name, UETT_##Name)
|
||||
#include "clang/Basic/TokenKinds.def"
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -1060,7 +1060,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(), StringRef MatcherName) {
|
|||
BuildReturnTypeVector<ReturnType>::build(RetTypes);
|
||||
return std::make_unique<FixedArgCountMatcherDescriptor>(
|
||||
matcherMarshall0<ReturnType>, reinterpret_cast<void (*)()>(Func),
|
||||
MatcherName, RetTypes, None);
|
||||
MatcherName, RetTypes, std::nullopt);
|
||||
}
|
||||
|
||||
/// 1-arg overload
|
||||
|
|
|
@ -910,10 +910,10 @@ Parser::parseMatcherExpression(StringRef &Code, Sema *S,
|
|||
Diagnostics *Error) {
|
||||
VariantValue Value;
|
||||
if (!parseExpression(Code, S, NamedValues, &Value, Error))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (!Value.isMatcher()) {
|
||||
Error->addError(SourceRange(), Error->ET_ParserNotAMatcher);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
llvm::Optional<DynTypedMatcher> Result =
|
||||
Value.getMatcher().getSingleMatcher();
|
||||
|
|
|
@ -75,11 +75,11 @@ VariantMatcher::MatcherOps::constructVariadicOperator(
|
|||
// Abort if any of the inner matchers can't be converted to
|
||||
// Matcher<T>.
|
||||
if (!InnerMatcher.Value)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
llvm::Optional<DynTypedMatcher> Inner =
|
||||
InnerMatcher.Value->getTypedMatcher(*this);
|
||||
if (!Inner)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
DynMatchers.push_back(*Inner);
|
||||
}
|
||||
return DynTypedMatcher::constructVariadic(Op, NodeKind, DynMatchers);
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
bool Ignore;
|
||||
if (Ops.canConstructFrom(Matcher, Ignore))
|
||||
return Matcher;
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity) const override {
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
|
||||
llvm::Optional<DynTypedMatcher> getSingleMatcher() const override {
|
||||
if (Matchers.size() != 1)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Matchers[0];
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
// We only succeed if we found exactly one, or if we found an exact match.
|
||||
if (Found && (FoundIsExact || NumFound == 1))
|
||||
return *Found;
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity) const override {
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
: Op(Op), Args(std::move(Args)) {}
|
||||
|
||||
llvm::Optional<DynTypedMatcher> getSingleMatcher() const override {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string getTypeAsString() const override {
|
||||
|
|
|
@ -797,7 +797,7 @@ llvm::Optional<clang::MacroExpansionContext>
|
|||
CrossTranslationUnitContext::getMacroExpansionContextForSourceLocation(
|
||||
const clang::SourceLocation &ToLoc) const {
|
||||
// FIXME: Implement: Record such a context for every imported ASTUnit; lookup.
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool CrossTranslationUnitContext::isImportedAsNew(const Decl *ToDecl) const {
|
||||
|
|
|
@ -18,7 +18,7 @@ Optional<sys::fs::file_status> getFileStatus(StringRef Path) {
|
|||
sys::fs::file_status Status;
|
||||
std::error_code EC = status(Path, Status);
|
||||
if (EC)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ struct SemaphorePipe {
|
|||
static llvm::Optional<SemaphorePipe> create() {
|
||||
int InotifyPollingStopperFDs[2];
|
||||
if (pipe2(InotifyPollingStopperFDs, O_CLOEXEC) == -1)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return SemaphorePipe(InotifyPollingStopperFDs);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -297,7 +297,7 @@ void Compilation::initCompilationForDiagnostics() {
|
|||
TCArgs.clear();
|
||||
|
||||
// Redirect stdout/stderr to /dev/null.
|
||||
Redirects = {None, {""}, {""}};
|
||||
Redirects = {std::nullopt, {""}, {""}};
|
||||
|
||||
// Temporary files added by diagnostics should be kept.
|
||||
ForceKeepTempFiles = true;
|
||||
|
|
|
@ -241,7 +241,7 @@ void Driver::setDriverMode(StringRef Value) {
|
|||
.Case("cl", CLMode)
|
||||
.Case("flang", FlangMode)
|
||||
.Case("dxc", DXCMode)
|
||||
.Default(None))
|
||||
.Default(std::nullopt))
|
||||
Mode = *M;
|
||||
else
|
||||
Diag(diag::err_drv_unsupported_option_argument) << OptName << Value;
|
||||
|
|
|
@ -226,7 +226,8 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
auto ExpCommand = std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::None(), CreateExportListExec,
|
||||
CreateExportCmdArgs, Inputs, Output);
|
||||
ExpCommand->setRedirectFiles({std::nullopt, std::string(ExportList), None});
|
||||
ExpCommand->setRedirectFiles(
|
||||
{std::nullopt, std::string(ExportList), std::nullopt});
|
||||
C.addCommand(std::move(ExpCommand));
|
||||
CmdArgs.push_back(Args.MakeArgString(llvm::Twine("-bE:") + ExportList));
|
||||
}
|
||||
|
|
|
@ -1619,7 +1619,7 @@ struct DarwinPlatform {
|
|||
if (const auto *MacCatalystToMacOSMapping = SDKInfo->getVersionMapping(
|
||||
DarwinSDKInfo::OSEnvPair::macCatalystToMacOSPair())) {
|
||||
if (auto MacOSVersion = MacCatalystToMacOSMapping->map(
|
||||
OSVersion, NativeTargetVersion, None)) {
|
||||
OSVersion, NativeTargetVersion, std::nullopt)) {
|
||||
NativeTargetVersion = *MacOSVersion;
|
||||
}
|
||||
}
|
||||
|
@ -2830,7 +2830,8 @@ void Darwin::addClangCC1ASTargetOptions(
|
|||
if (const auto *MacOStoMacCatalystMapping = SDKInfo->getVersionMapping(
|
||||
DarwinSDKInfo::OSEnvPair::macOStoMacCatalystPair())) {
|
||||
Optional<VersionTuple> SDKVersion = MacOStoMacCatalystMapping->map(
|
||||
SDKInfo->getVersion(), minimumMacCatalystDeploymentTarget(), None);
|
||||
SDKInfo->getVersion(), minimumMacCatalystDeploymentTarget(),
|
||||
std::nullopt);
|
||||
EmitTargetSDKVersionArg(
|
||||
SDKVersion ? *SDKVersion : minimumMacCatalystDeploymentTarget());
|
||||
}
|
||||
|
@ -2851,7 +2852,7 @@ void Darwin::addClangCC1ASTargetOptions(
|
|||
DarwinSDKInfo::OSEnvPair::macOStoMacCatalystPair())) {
|
||||
if (Optional<VersionTuple> SDKVersion = MacOStoMacCatalystMapping->map(
|
||||
SDKInfo->getVersion(), minimumMacCatalystDeploymentTarget(),
|
||||
None)) {
|
||||
std::nullopt)) {
|
||||
std::string Arg;
|
||||
llvm::raw_string_ostream OS(Arg);
|
||||
OS << "-darwin-target-variant-sdk-version=" << *SDKVersion;
|
||||
|
@ -3097,7 +3098,7 @@ void Darwin::addPlatformVersionArgs(const llvm::opt::ArgList &Args,
|
|||
DarwinSDKInfo::OSEnvPair::macOStoMacCatalystPair())) {
|
||||
iOSSDKVersion = MacOStoMacCatalystMapping->map(
|
||||
SDKInfo->getVersion().withoutBuild(),
|
||||
minimumMacCatalystDeploymentTarget(), None);
|
||||
minimumMacCatalystDeploymentTarget(), std::nullopt);
|
||||
}
|
||||
}
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
|
|
|
@ -218,7 +218,7 @@ public:
|
|||
public:
|
||||
explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
|
||||
void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args,
|
||||
ArrayRef<std::string> ExtraTripleAliases = None);
|
||||
ArrayRef<std::string> ExtraTripleAliases = std::nullopt);
|
||||
|
||||
/// Check whether we detected a valid GCC install.
|
||||
bool isValid() const { return IsValid; }
|
||||
|
|
|
@ -157,7 +157,7 @@ Optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
|
|||
Rule.match(File, &Matches);
|
||||
// Returned matches are always in stable order.
|
||||
if (Matches.size() != 4)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return path::convert_to_slash(
|
||||
(Matches[1].drop_front(Matches[1].rfind('/') + 1) + "/" +
|
||||
|
@ -172,7 +172,7 @@ Optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
|
|||
}
|
||||
|
||||
// Couldn't determine a include name, use full path instead.
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
struct LocationFileChecker {
|
||||
|
|
|
@ -60,7 +60,7 @@ void serializeArray(Object &Paren, StringRef Key, Optional<Array> Array) {
|
|||
/// the semantic version representation of \p V.
|
||||
Optional<Object> serializeSemanticVersion(const VersionTuple &V) {
|
||||
if (V.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Object Version;
|
||||
Version["major"] = V.getMajor();
|
||||
|
@ -146,7 +146,7 @@ Object serializeSourceRange(const PresumedLoc &BeginLoc,
|
|||
/// an \c Array containing the formatted availability information.
|
||||
Optional<Array> serializeAvailability(const AvailabilitySet &Availabilities) {
|
||||
if (Availabilities.isDefault())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Array AvailabilityArray;
|
||||
|
||||
|
@ -232,7 +232,7 @@ Object serializeIdentifier(const APIRecord &Record, Language Lang) {
|
|||
/// formatted lines.
|
||||
Optional<Object> serializeDocComment(const DocComment &Comment) {
|
||||
if (Comment.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Object DocComment;
|
||||
Array LinesArray;
|
||||
|
@ -284,7 +284,7 @@ Optional<Object> serializeDocComment(const DocComment &Comment) {
|
|||
/// declaration fragments array.
|
||||
Optional<Array> serializeDeclarationFragments(const DeclarationFragments &DF) {
|
||||
if (DF.getFragments().empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Array Fragments;
|
||||
for (const auto &F : DF.getFragments()) {
|
||||
|
@ -412,7 +412,7 @@ Optional<Object> serializeFunctionSignatureMixinImpl(const RecordTy &Record,
|
|||
std::true_type) {
|
||||
const auto &FS = Record.Signature;
|
||||
if (FS.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Object Signature;
|
||||
serializeArray(Signature, "returns",
|
||||
|
@ -436,7 +436,7 @@ Optional<Object> serializeFunctionSignatureMixinImpl(const RecordTy &Record,
|
|||
template <typename RecordTy>
|
||||
Optional<Object> serializeFunctionSignatureMixinImpl(const RecordTy &Record,
|
||||
std::false_type) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Serialize the function signature field, as specified by the
|
||||
|
@ -501,7 +501,7 @@ template <typename RecordTy>
|
|||
Optional<Object>
|
||||
SymbolGraphSerializer::serializeAPIRecord(const RecordTy &Record) const {
|
||||
if (shouldSkip(Record))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Object Obj;
|
||||
serializeObject(Obj, "identifier",
|
||||
|
|
|
@ -152,7 +152,7 @@ static bool opensProtoMessageField(const FormatToken &LessTok,
|
|||
static llvm::Optional<StringRef> getRawStringDelimiter(StringRef TokenText) {
|
||||
if (TokenText.size() < 5 // The smallest raw string possible is 'R"()"'.
|
||||
|| !TokenText.startswith("R\"") || !TokenText.endswith("\"")) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// A raw string starts with 'R"<delimiter>(' and delimiter is ascii and has
|
||||
|
@ -160,15 +160,15 @@ static llvm::Optional<StringRef> getRawStringDelimiter(StringRef TokenText) {
|
|||
// 19 bytes.
|
||||
size_t LParenPos = TokenText.substr(0, 19).find_first_of('(');
|
||||
if (LParenPos == StringRef::npos)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
StringRef Delimiter = TokenText.substr(2, LParenPos - 2);
|
||||
|
||||
// Check that the string ends in ')Delimiter"'.
|
||||
size_t RParenPos = TokenText.size() - Delimiter.size() - 2;
|
||||
if (TokenText[RParenPos] != ')')
|
||||
return None;
|
||||
return std::nullopt;
|
||||
if (!TokenText.substr(RParenPos + 1).startswith(Delimiter))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return Delimiter;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ llvm::Optional<FormatStyle>
|
|||
RawStringFormatStyleManager::getDelimiterStyle(StringRef Delimiter) const {
|
||||
auto It = DelimiterStyle.find(Delimiter);
|
||||
if (It == DelimiterStyle.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return It->second;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ RawStringFormatStyleManager::getEnclosingFunctionStyle(
|
|||
StringRef EnclosingFunction) const {
|
||||
auto It = EnclosingFunctionStyle.find(EnclosingFunction);
|
||||
if (It == EnclosingFunctionStyle.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return It->second;
|
||||
}
|
||||
|
||||
|
@ -2071,17 +2071,17 @@ llvm::Optional<FormatStyle>
|
|||
ContinuationIndenter::getRawStringStyle(const FormatToken &Current,
|
||||
const LineState &State) {
|
||||
if (!Current.isStringLiteral())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
auto Delimiter = getRawStringDelimiter(Current.TokenText);
|
||||
if (!Delimiter)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
auto RawStringStyle = RawStringFormats.getDelimiterStyle(*Delimiter);
|
||||
if (!RawStringStyle && Delimiter->empty()) {
|
||||
RawStringStyle = RawStringFormats.getEnclosingFunctionStyle(
|
||||
getEnclosingFunctionName(Current));
|
||||
}
|
||||
if (!RawStringStyle)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
RawStringStyle->ColumnLimit = getColumnLimit(State);
|
||||
return RawStringStyle;
|
||||
}
|
||||
|
|
|
@ -1874,10 +1874,10 @@ std::string configurationAsText(const FormatStyle &Style) {
|
|||
llvm::Optional<FormatStyle>
|
||||
FormatStyle::FormatStyleSet::Get(FormatStyle::LanguageKind Language) const {
|
||||
if (!Styles)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
auto It = Styles->find(Language);
|
||||
if (It == Styles->end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
FormatStyle Style = It->second;
|
||||
Style.StyleSet = *this;
|
||||
return Style;
|
||||
|
|
|
@ -2246,7 +2246,7 @@ void ASTUnit::CodeComplete(
|
|||
[&FileMgr](StringRef Filename) -> Optional<llvm::sys::fs::UniqueID> {
|
||||
if (auto Status = FileMgr.getVirtualFileSystem().status(Filename))
|
||||
return Status->getUniqueID();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
auto hasSameUniqueID = [getUniqueID](StringRef LHS, StringRef RHS) {
|
||||
|
|
|
@ -1289,7 +1289,7 @@ static Optional<FileEntryRef> getPublicModuleMap(FileEntryRef File,
|
|||
else if (Filename == "module.private.modulemap")
|
||||
llvm::sys::path::append(PublicFilename, "module.modulemap");
|
||||
else
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return FileMgr.getOptionalFileRef(PublicFilename);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ static llvm::Optional<bool> normalizeSimpleFlag(OptSpecifier Opt,
|
|||
DiagnosticsEngine &Diags) {
|
||||
if (Args.hasArg(Opt))
|
||||
return true;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<bool> normalizeSimpleNegativeFlag(OptSpecifier Opt, unsigned,
|
||||
|
@ -184,7 +184,7 @@ static Optional<bool> normalizeSimpleNegativeFlag(OptSpecifier Opt, unsigned,
|
|||
DiagnosticsEngine &) {
|
||||
if (Args.hasArg(Opt))
|
||||
return false;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// The tblgen-erated code passes in a fifth parameter of an arbitrary type, but
|
||||
|
@ -209,7 +209,7 @@ static auto makeFlagToValueNormalizer(T Value) {
|
|||
DiagnosticsEngine &) -> Optional<T> {
|
||||
if (Args.hasArg(Opt))
|
||||
return Value;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ static auto makeBooleanOptionNormalizer(bool Value, bool OtherValue,
|
|||
if (const Arg *A = Args.getLastArg(Opt, OtherOpt)) {
|
||||
return A->getOption().matches(Opt) ? Value : OtherValue;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ findValueTableByName(const SimpleEnumValueTable &Table, StringRef Name) {
|
|||
if (Name == Table.Table[I].Name)
|
||||
return Table.Table[I];
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<SimpleEnumValue>
|
||||
|
@ -285,7 +285,7 @@ findValueTableByValue(const SimpleEnumValueTable &Table, unsigned Value) {
|
|||
if (Value == Table.Table[I].Value)
|
||||
return Table.Table[I];
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static llvm::Optional<unsigned> normalizeSimpleEnum(OptSpecifier Opt,
|
||||
|
@ -297,7 +297,7 @@ static llvm::Optional<unsigned> normalizeSimpleEnum(OptSpecifier Opt,
|
|||
|
||||
auto *Arg = Args.getLastArg(Opt);
|
||||
if (!Arg)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
StringRef ArgValue = Arg->getValue();
|
||||
if (auto MaybeEnumVal = findValueTableByName(Table, ArgValue))
|
||||
|
@ -305,7 +305,7 @@ static llvm::Optional<unsigned> normalizeSimpleEnum(OptSpecifier Opt,
|
|||
|
||||
Diags.Report(diag::err_drv_invalid_value)
|
||||
<< Arg->getAsString(Args) << ArgValue;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static void denormalizeSimpleEnumImpl(SmallVectorImpl<const char *> &Args,
|
||||
|
@ -339,7 +339,7 @@ static Optional<std::string> normalizeString(OptSpecifier Opt, int TableIndex,
|
|||
DiagnosticsEngine &Diags) {
|
||||
auto *Arg = Args.getLastArg(Opt);
|
||||
if (!Arg)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return std::string(Arg->getValue());
|
||||
}
|
||||
|
||||
|
@ -349,12 +349,12 @@ static Optional<IntTy> normalizeStringIntegral(OptSpecifier Opt, int,
|
|||
DiagnosticsEngine &Diags) {
|
||||
auto *Arg = Args.getLastArg(Opt);
|
||||
if (!Arg)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
IntTy Res;
|
||||
if (StringRef(Arg->getValue()).getAsInteger(0, Res)) {
|
||||
Diags.Report(diag::err_drv_invalid_int_value)
|
||||
<< Arg->getAsString(Args) << Arg->getValue();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
return Res;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ static Optional<std::string> normalizeTriple(OptSpecifier Opt, int TableIndex,
|
|||
DiagnosticsEngine &Diags) {
|
||||
auto *Arg = Args.getLastArg(Opt);
|
||||
if (!Arg)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return llvm::Triple::normalize(Arg->getValue());
|
||||
}
|
||||
|
||||
|
@ -1064,11 +1064,12 @@ static void initOption(AnalyzerOptions::ConfigTable &Config,
|
|||
static void initOption(AnalyzerOptions::ConfigTable &Config,
|
||||
DiagnosticsEngine *Diags,
|
||||
bool &OptionField, StringRef Name, bool DefaultVal) {
|
||||
auto PossiblyInvalidVal = llvm::StringSwitch<Optional<bool>>(
|
||||
getStringOption(Config, Name, (DefaultVal ? "true" : "false")))
|
||||
.Case("true", true)
|
||||
.Case("false", false)
|
||||
.Default(None);
|
||||
auto PossiblyInvalidVal =
|
||||
llvm::StringSwitch<Optional<bool>>(
|
||||
getStringOption(Config, Name, (DefaultVal ? "true" : "false")))
|
||||
.Case("true", true)
|
||||
.Case("false", false)
|
||||
.Default(std::nullopt);
|
||||
|
||||
if (!PossiblyInvalidVal) {
|
||||
if (Diags)
|
||||
|
@ -1382,10 +1383,10 @@ void CompilerInvocation::GenerateCodeGenArgs(
|
|||
DebugInfoVal = "unused-types";
|
||||
break;
|
||||
case codegenoptions::NoDebugInfo: // default value
|
||||
DebugInfoVal = None;
|
||||
DebugInfoVal = std::nullopt;
|
||||
break;
|
||||
case codegenoptions::LocTrackingOnly: // implied value
|
||||
DebugInfoVal = None;
|
||||
DebugInfoVal = std::nullopt;
|
||||
break;
|
||||
}
|
||||
if (DebugInfoVal)
|
||||
|
@ -2504,7 +2505,7 @@ static Optional<frontend::ActionKind> getFrontendAction(OptSpecifier &Opt) {
|
|||
if (ActionOpt.second == Opt.getID())
|
||||
return ActionOpt.first;
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Maps frontend action to command line option.
|
||||
|
@ -2514,7 +2515,7 @@ getProgramActionOpt(frontend::ActionKind ProgramAction) {
|
|||
if (ActionOpt.first == ProgramAction)
|
||||
return OptSpecifier(ActionOpt.second);
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static void GenerateFrontendArgs(const FrontendOptions &Opts,
|
||||
|
@ -2996,8 +2997,8 @@ static void GenerateHeaderSearchArgs(HeaderSearchOptions &Opts,
|
|||
auto End = Opts.UserEntries.end();
|
||||
|
||||
// Add -I..., -F..., and -index-header-map options in order.
|
||||
for (; It < End &&
|
||||
Matches(*It, {frontend::IndexHeaderMap, frontend::Angled}, None, true);
|
||||
for (; It < End && Matches(*It, {frontend::IndexHeaderMap, frontend::Angled},
|
||||
std::nullopt, true);
|
||||
++It) {
|
||||
OptSpecifier Opt = [It, Matches]() {
|
||||
if (Matches(*It, frontend::IndexHeaderMap, true, true))
|
||||
|
@ -3035,7 +3036,8 @@ static void GenerateHeaderSearchArgs(HeaderSearchOptions &Opts,
|
|||
GenerateArg(Args, OPT_idirafter, It->Path, SA);
|
||||
for (; It < End && Matches(*It, {frontend::Quoted}, false, true); ++It)
|
||||
GenerateArg(Args, OPT_iquote, It->Path, SA);
|
||||
for (; It < End && Matches(*It, {frontend::System}, false, None); ++It)
|
||||
for (; It < End && Matches(*It, {frontend::System}, false, std::nullopt);
|
||||
++It)
|
||||
GenerateArg(Args, It->IgnoreSysRoot ? OPT_isystem : OPT_iwithsysroot,
|
||||
It->Path, SA);
|
||||
for (; It < End && Matches(*It, {frontend::System}, true, true); ++It)
|
||||
|
|
|
@ -148,7 +148,7 @@ void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) {
|
|||
|
||||
void DiagnosticRenderer::emitBasicNote(StringRef Message) {
|
||||
emitDiagnosticMessage(FullSourceLoc(), PresumedLoc(), DiagnosticsEngine::Note,
|
||||
Message, None, DiagOrStoredDiag());
|
||||
Message, std::nullopt, DiagOrStoredDiag());
|
||||
}
|
||||
|
||||
/// Prints an include stack when appropriate for a particular
|
||||
|
@ -453,7 +453,7 @@ void DiagnosticRenderer::emitSingleMacroExpansion(
|
|||
Message << "expanded from macro '" << MacroName << "'";
|
||||
|
||||
emitDiagnostic(SpellingLoc, DiagnosticsEngine::Note, Message.str(),
|
||||
SpellingRanges, None);
|
||||
SpellingRanges, std::nullopt);
|
||||
}
|
||||
|
||||
/// Check that the macro argument location of Loc starts with ArgumentLoc.
|
||||
|
|
|
@ -335,7 +335,7 @@ static std::error_code collectModuleHeaderIncludes(
|
|||
return std::error_code();
|
||||
|
||||
// Resolve all lazy header directives to header files.
|
||||
ModMap.resolveHeaderDirectives(Module, /*File=*/llvm::None);
|
||||
ModMap.resolveHeaderDirectives(Module, /*File=*/std::nullopt);
|
||||
|
||||
// If any headers are missing, we can't build this module. In most cases,
|
||||
// diagnostics for this should have already been produced; we only get here
|
||||
|
|
|
@ -926,12 +926,13 @@ void TextDiagnostic::emitBuildingModuleLocation(FullSourceLoc Loc,
|
|||
static llvm::Optional<std::pair<unsigned, unsigned>>
|
||||
findLinesForRange(const CharSourceRange &R, FileID FID,
|
||||
const SourceManager &SM) {
|
||||
if (!R.isValid()) return None;
|
||||
if (!R.isValid())
|
||||
return std::nullopt;
|
||||
|
||||
SourceLocation Begin = R.getBegin();
|
||||
SourceLocation End = R.getEnd();
|
||||
if (SM.getFileID(Begin) != FID || SM.getFileID(End) != FID)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_pair(SM.getExpansionLineNumber(Begin),
|
||||
SM.getExpansionLineNumber(End));
|
||||
|
|
|
@ -68,20 +68,18 @@ public:
|
|||
static bool isTemplateImplicitInstantiation(const Decl *D);
|
||||
|
||||
bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(),
|
||||
ArrayRef<SymbolRelation> Relations = None);
|
||||
ArrayRef<SymbolRelation> Relations = std::nullopt);
|
||||
|
||||
bool handleDecl(const Decl *D, SourceLocation Loc,
|
||||
SymbolRoleSet Roles = SymbolRoleSet(),
|
||||
ArrayRef<SymbolRelation> Relations = None,
|
||||
ArrayRef<SymbolRelation> Relations = std::nullopt,
|
||||
const DeclContext *DC = nullptr);
|
||||
|
||||
bool handleReference(const NamedDecl *D, SourceLocation Loc,
|
||||
const NamedDecl *Parent,
|
||||
const DeclContext *DC,
|
||||
const NamedDecl *Parent, const DeclContext *DC,
|
||||
SymbolRoleSet Roles = SymbolRoleSet(),
|
||||
ArrayRef<SymbolRelation> Relations = None,
|
||||
const Expr *RefE = nullptr,
|
||||
const Decl *RefD = nullptr);
|
||||
ArrayRef<SymbolRelation> Relations = std::nullopt,
|
||||
const Expr *RefE = nullptr, const Decl *RefD = nullptr);
|
||||
|
||||
void handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc,
|
||||
const MacroInfo &MI);
|
||||
|
@ -97,7 +95,7 @@ public:
|
|||
bool indexDecl(const Decl *D);
|
||||
|
||||
void indexTagDecl(const TagDecl *D,
|
||||
ArrayRef<SymbolRelation> Relations = None);
|
||||
ArrayRef<SymbolRelation> Relations = std::nullopt);
|
||||
|
||||
void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent,
|
||||
const DeclContext *DC = nullptr,
|
||||
|
|
|
@ -530,7 +530,7 @@ Scanner::tryLexIdentifierOrSkipLine(const char *&First, const char *const End) {
|
|||
if (Tok.isNot(tok::raw_identifier)) {
|
||||
if (!Tok.is(tok::eod))
|
||||
skipLine(First, End);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool NeedsCleaning = Tok.Flags & clang::Token::NeedsCleaning;
|
||||
|
|
|
@ -151,7 +151,7 @@ Optional<StringRef> HeaderMapImpl::getString(unsigned StrTabIdx) const {
|
|||
|
||||
// Check for invalid index.
|
||||
if (StrTabIdx >= FileBuffer->getBufferSize())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
const char *Data = FileBuffer->getBufferStart() + StrTabIdx;
|
||||
unsigned MaxLen = FileBuffer->getBufferSize() - StrTabIdx;
|
||||
|
@ -159,7 +159,7 @@ Optional<StringRef> HeaderMapImpl::getString(unsigned StrTabIdx) const {
|
|||
|
||||
// Check whether the buffer is null-terminated.
|
||||
if (Len == MaxLen && Data[Len - 1])
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return StringRef(Data, Len);
|
||||
}
|
||||
|
|
|
@ -432,14 +432,14 @@ Optional<FileEntryRef> HeaderSearch::getFileAndSuggestModule(
|
|||
Diags.Report(IncludeLoc, diag::err_cannot_open_file)
|
||||
<< FileName << EC.message();
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// If there is a module that corresponds to this header, suggest it.
|
||||
if (!findUsableModuleForHeader(
|
||||
&File->getFileEntry(), Dir ? Dir : File->getFileEntry().getDir(),
|
||||
RequestingModule, SuggestedModule, IsSystemHeaderDir))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return *File;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
|
|||
SmallString<1024> Path;
|
||||
StringRef Dest = HM->lookupFilename(Filename, Path);
|
||||
if (Dest.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
IsInHeaderMap = true;
|
||||
|
||||
|
@ -522,7 +522,7 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
|
|||
// function as part of the regular logic that applies to include search paths.
|
||||
// The case where the target file **does not exist** is handled here:
|
||||
HS.noteLookupUsage(HS.searchDirIdx(*this), IncludeLoc);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Given a framework directory, find the top-most framework directory.
|
||||
|
@ -595,7 +595,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
|
|||
// Framework names must have a '/' in the filename.
|
||||
size_t SlashPos = Filename.find('/');
|
||||
if (SlashPos == StringRef::npos)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Find out if this is the home for the specified framework, by checking
|
||||
// HeaderSearch. Possible answers are yes/no and unknown.
|
||||
|
@ -604,7 +604,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
|
|||
|
||||
// If it is known and in some other directory, fail.
|
||||
if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDirRef())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Otherwise, construct the path to this framework dir.
|
||||
|
||||
|
@ -628,7 +628,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
|
|||
// If the framework dir doesn't exist, we fail.
|
||||
auto Dir = FileMgr.getDirectory(FrameworkName);
|
||||
if (!Dir)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Otherwise, if it does, remember that this is the right direntry for this
|
||||
// framework.
|
||||
|
@ -711,17 +711,17 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
|
|||
if (!HS.findUsableModuleForFrameworkHeader(
|
||||
&File->getFileEntry(), FrameworkPath, RequestingModule,
|
||||
SuggestedModule, IsSystem))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
} else {
|
||||
if (!HS.findUsableModuleForHeader(&File->getFileEntry(), getDir(),
|
||||
RequestingModule, SuggestedModule,
|
||||
IsSystem))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
if (File)
|
||||
return *File;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void HeaderSearch::cacheLookupSuccess(LookupFileCacheInfo &CacheLookup,
|
||||
|
@ -880,7 +880,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
|
|||
|
||||
// If this was an #include_next "/absolute/file", fail.
|
||||
if (FromDir)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
if (SearchPath)
|
||||
SearchPath->clear();
|
||||
|
@ -1166,7 +1166,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
|
|||
|
||||
// Otherwise, didn't find it. Remember we didn't find this.
|
||||
CacheLookup.HitIt = search_dir_end();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// LookupSubframeworkHeader - Look up a subframework for the specified
|
||||
|
@ -1184,7 +1184,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
// FIXME: Should we permit '\' on Windows?
|
||||
size_t SlashPos = Filename.find('/');
|
||||
if (SlashPos == StringRef::npos)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Look up the base framework name of the ContextFileEnt.
|
||||
StringRef ContextName = ContextFileEnt->getName();
|
||||
|
@ -1195,7 +1195,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
if (FrameworkPos == StringRef::npos ||
|
||||
(ContextName[FrameworkPos + DotFrameworkLen] != '/' &&
|
||||
ContextName[FrameworkPos + DotFrameworkLen] != '\\'))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
SmallString<1024> FrameworkName(ContextName.data(), ContextName.data() +
|
||||
FrameworkPos +
|
||||
|
@ -1215,7 +1215,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
CacheLookup.first().size() == FrameworkName.size() &&
|
||||
memcmp(CacheLookup.first().data(), &FrameworkName[0],
|
||||
CacheLookup.first().size()) != 0)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Cache subframework.
|
||||
if (!CacheLookup.second.Directory) {
|
||||
|
@ -1224,7 +1224,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
// If the framework dir doesn't exist, we fail.
|
||||
auto Dir = FileMgr.getOptionalDirectoryRef(FrameworkName);
|
||||
if (!Dir)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Otherwise, if it does, remember that this is the right direntry for this
|
||||
// framework.
|
||||
|
@ -1262,7 +1262,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
File = FileMgr.getOptionalFileRef(HeadersFilename, /*OpenFile=*/true);
|
||||
|
||||
if (!File)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// This file is a system header or C++ unfriendly if the old file is.
|
||||
|
@ -1277,7 +1277,7 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
|
|||
if (!findUsableModuleForFrameworkHeader(&File->getFileEntry(), FrameworkName,
|
||||
RequestingModule, SuggestedModule,
|
||||
/*IsSystem*/ false))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return *File;
|
||||
}
|
||||
|
|
|
@ -62,14 +62,14 @@ public:
|
|||
/// if used.
|
||||
/// Returns true if the path exists, false if it was ignored.
|
||||
bool AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework,
|
||||
Optional<unsigned> UserEntryIdx = None);
|
||||
Optional<unsigned> UserEntryIdx = std::nullopt);
|
||||
|
||||
/// Add the specified path to the specified group list, without performing any
|
||||
/// sysroot remapping.
|
||||
/// Returns true if the path exists, false if it was ignored.
|
||||
bool AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
|
||||
bool isFramework,
|
||||
Optional<unsigned> UserEntryIdx = None);
|
||||
Optional<unsigned> UserEntryIdx = std::nullopt);
|
||||
|
||||
/// Add the specified prefix to the system header prefix list.
|
||||
void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {
|
||||
|
|
|
@ -1261,7 +1261,7 @@ Optional<Token> Lexer::findNextToken(SourceLocation Loc,
|
|||
const LangOptions &LangOpts) {
|
||||
if (Loc.isMacroID()) {
|
||||
if (!Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
Loc = Lexer::getLocForEndOfToken(Loc, 0, SM, LangOpts);
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ Optional<Token> Lexer::findNextToken(SourceLocation Loc,
|
|||
bool InvalidTemp = false;
|
||||
StringRef File = SM.getBufferData(LocInfo.first, &InvalidTemp);
|
||||
if (InvalidTemp)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
const char *TokenBegin = File.data() + LocInfo.second;
|
||||
|
||||
|
@ -3216,7 +3216,7 @@ llvm::Optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
|
|||
if (!LangOpts.CPlusPlus && !LangOpts.C99) {
|
||||
if (Diagnose)
|
||||
Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const char *CurPtr = StartPtr + CharSize;
|
||||
|
@ -3244,13 +3244,13 @@ llvm::Optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
|
|||
if (Diagnose)
|
||||
Diag(BufferPtr, diag::warn_delimited_ucn_incomplete)
|
||||
<< StringRef(KindLoc, 1);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (CodePoint & 0xF000'0000) {
|
||||
if (Diagnose)
|
||||
Diag(KindLoc, diag::err_escape_too_large) << 0;
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
CodePoint <<= 4;
|
||||
|
@ -3264,13 +3264,13 @@ llvm::Optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
|
|||
Diag(StartPtr, FoundEndDelimiter ? diag::warn_delimited_ucn_empty
|
||||
: diag::warn_ucn_escape_no_digits)
|
||||
<< StringRef(KindLoc, 1);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (Delimited && Kind == 'U') {
|
||||
if (Diagnose)
|
||||
Diag(StartPtr, diag::err_hex_escape_no_digits) << StringRef(KindLoc, 1);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!Delimited && Count != NumHexDigits) {
|
||||
|
@ -3283,7 +3283,7 @@ llvm::Optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
|
|||
<< FixItHint::CreateReplacement(URange, "u");
|
||||
}
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (Delimited && PP) {
|
||||
|
@ -3321,7 +3321,7 @@ llvm::Optional<uint32_t> Lexer::tryReadNamedUCN(const char *&StartPtr,
|
|||
if (C != '{') {
|
||||
if (Diagnose)
|
||||
Diag(StartPtr, diag::warn_ucn_escape_incomplete);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
CurPtr += CharSize;
|
||||
const char *StartName = CurPtr;
|
||||
|
@ -3345,7 +3345,7 @@ llvm::Optional<uint32_t> Lexer::tryReadNamedUCN(const char *&StartPtr,
|
|||
Diag(StartPtr, FoundEndDelimiter ? diag::warn_delimited_ucn_empty
|
||||
: diag::warn_delimited_ucn_incomplete)
|
||||
<< StringRef(KindLoc, 1);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
StringRef Name(Buffer.data(), Buffer.size());
|
||||
|
@ -3367,7 +3367,7 @@ llvm::Optional<uint32_t> Lexer::tryReadNamedUCN(const char *&StartPtr,
|
|||
// When finding a match using Unicode loose matching rules
|
||||
// recover after having emitted a diagnostic.
|
||||
if (!LooseMatch)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
// We do not offer misspelled character names suggestions here
|
||||
// as the set of what would be a valid suggestion depends on context,
|
||||
// and we should not make invalid suggestions.
|
||||
|
|
|
@ -189,7 +189,7 @@ Optional<FileEntryRef> ModuleMap::findHeader(
|
|||
expectedToOptional(SourceMgr.getFileManager().getFileRef(Filename));
|
||||
if (!File || (Header.Size && File->getSize() != *Header.Size) ||
|
||||
(Header.ModTime && File->getModificationTime() != *Header.ModTime))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return *File;
|
||||
};
|
||||
|
||||
|
@ -247,7 +247,7 @@ Optional<FileEntryRef> ModuleMap::findHeader(
|
|||
<< Header.FileName << M->getFullModuleName();
|
||||
NeedsFramework = true;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return NormalHdrFile;
|
||||
|
@ -482,7 +482,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
|
|||
|
||||
if (RequestingModule) {
|
||||
resolveUses(RequestingModule, /*Complain=*/false);
|
||||
resolveHeaderDirectives(RequestingModule, /*File=*/llvm::None);
|
||||
resolveHeaderDirectives(RequestingModule, /*File=*/std::nullopt);
|
||||
}
|
||||
|
||||
bool Excluded = false;
|
||||
|
@ -690,7 +690,7 @@ ModuleMap::findAllModulesForHeader(const FileEntry *File) {
|
|||
if (findOrCreateModuleForHeaderInUmbrellaDir(File))
|
||||
return Headers.find(File)->second;
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ArrayRef<ModuleMap::KnownHeader>
|
||||
|
@ -699,7 +699,7 @@ ModuleMap::findResolvedModulesForHeader(const FileEntry *File) const {
|
|||
resolveHeaderDirectives(File);
|
||||
auto It = Headers.find(File);
|
||||
if (It == Headers.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return It->second;
|
||||
}
|
||||
|
||||
|
@ -1262,7 +1262,7 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header,
|
|||
Optional<FileEntryRef>
|
||||
ModuleMap::getContainingModuleMapFile(const Module *Module) const {
|
||||
if (Module->DefinitionLoc.isInvalid())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return SourceMgr.getFileEntryRefForID(
|
||||
SourceMgr.getFileID(Module->DefinitionLoc));
|
||||
|
|
|
@ -307,7 +307,7 @@ static Optional<StringRef> findSimilarStr(
|
|||
if (SimilarStr) {
|
||||
return SimilarStr->first;
|
||||
} else {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ Optional<FileEntryRef> Preprocessor::LookupFile(
|
|||
}
|
||||
|
||||
// Otherwise, we really couldn't find the file.
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -2020,7 +2020,7 @@ Optional<FileEntryRef> Preprocessor::LookupHeaderIncludeOrImport(
|
|||
return File;
|
||||
|
||||
if (SuppressIncludeNotFoundError)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// If the file could not be located and it was included via angle
|
||||
// brackets, we can attempt a lookup as though it were a quoted path to
|
||||
|
@ -2095,7 +2095,7 @@ Optional<FileEntryRef> Preprocessor::LookupHeaderIncludeOrImport(
|
|||
<< CacheEntry.Directory->getName();
|
||||
}
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Handle either a #include-like directive or an import declaration that names
|
||||
|
|
|
@ -285,7 +285,8 @@ void Preprocessor::dumpMacroInfo(const IdentifierInfo *II) {
|
|||
|
||||
// Dump module macros.
|
||||
llvm::DenseSet<ModuleMacro*> Active;
|
||||
for (auto *MM : State ? State->getActiveModuleMacros(*this, II) : None)
|
||||
for (auto *MM :
|
||||
State ? State->getActiveModuleMacros(*this, II) : std::nullopt)
|
||||
Active.insert(MM);
|
||||
llvm::DenseSet<ModuleMacro*> Visited;
|
||||
llvm::SmallVector<ModuleMacro *, 16> Worklist(Leaf.begin(), Leaf.end());
|
||||
|
|
|
@ -2421,8 +2421,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||
// Recover as if it were an explicit specialization.
|
||||
TemplateParameterLists FakedParamLists;
|
||||
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, None,
|
||||
LAngleLoc, nullptr));
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
|
||||
std::nullopt, LAngleLoc, nullptr));
|
||||
|
||||
ThisDecl =
|
||||
Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D);
|
||||
|
|
|
@ -1999,8 +1999,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
|||
// "template<>", so that we treat this construct as a class
|
||||
// template specialization.
|
||||
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, None,
|
||||
LAngleLoc, nullptr));
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
|
||||
std::nullopt, LAngleLoc, nullptr));
|
||||
TemplateParams = &FakedParamLists;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3612,8 +3612,8 @@ ExprResult Parser::ParseBlockLiteralExpression() {
|
|||
/*NumExceptions=*/0,
|
||||
/*NoexceptExpr=*/nullptr,
|
||||
/*ExceptionSpecTokens=*/nullptr,
|
||||
/*DeclsInPrototype=*/None, CaretLoc,
|
||||
CaretLoc, ParamInfo),
|
||||
/*DeclsInPrototype=*/std::nullopt,
|
||||
CaretLoc, CaretLoc, ParamInfo),
|
||||
CaretLoc);
|
||||
|
||||
MaybeParseGNUAttributes(ParamInfo);
|
||||
|
@ -3702,11 +3702,11 @@ Optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
|
|||
if (Tok.is(tok::code_completion)) {
|
||||
cutOffParsing();
|
||||
Actions.CodeCompleteAvailabilityPlatformName();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_avail_query_expected_platform_name);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
IdentifierLoc *PlatformIdentifier = ParseIdentifierLoc();
|
||||
|
@ -3714,7 +3714,7 @@ Optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
|
|||
VersionTuple Version = ParseVersionTuple(VersionRange);
|
||||
|
||||
if (Version.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
StringRef GivenPlatform = PlatformIdentifier->Ident->getName();
|
||||
StringRef Platform =
|
||||
|
@ -3724,7 +3724,7 @@ Optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
|
|||
Diag(PlatformIdentifier->Loc,
|
||||
diag::err_avail_query_unrecognized_platform_name)
|
||||
<< GivenPlatform;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return AvailabilitySpec(Version, Platform, PlatformIdentifier->Loc,
|
||||
|
|
|
@ -1443,8 +1443,8 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
|
|||
DynamicExceptions.size(),
|
||||
NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr,
|
||||
/*ExceptionSpecTokens*/ nullptr,
|
||||
/*DeclsInPrototype=*/None, LParenLoc, FunLocalRangeEnd, D,
|
||||
TrailingReturnType, TrailingReturnTypeLoc, &DS),
|
||||
/*DeclsInPrototype=*/std::nullopt, LParenLoc, FunLocalRangeEnd,
|
||||
D, TrailingReturnType, TrailingReturnTypeLoc, &DS),
|
||||
std::move(Attr), DeclEndLoc);
|
||||
};
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ ExprResult Parser::ParseBraceInitializer() {
|
|||
if (!getLangOpts().CPlusPlus)
|
||||
Diag(LBraceLoc, diag::ext_gnu_empty_initializer);
|
||||
// Match the '}'.
|
||||
return Actions.ActOnInitList(LBraceLoc, None, ConsumeBrace());
|
||||
return Actions.ActOnInitList(LBraceLoc, std::nullopt, ConsumeBrace());
|
||||
}
|
||||
|
||||
// Enter an appropriate expression evaluation context for an initializer list.
|
||||
|
|
|
@ -3201,14 +3201,14 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
|||
if (Tok.is(tok::code_completion)) {
|
||||
cutOffParsing();
|
||||
if (SuperLoc.isValid())
|
||||
Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc, None,
|
||||
false);
|
||||
Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
|
||||
std::nullopt, false);
|
||||
else if (ReceiverType)
|
||||
Actions.CodeCompleteObjCClassMessage(getCurScope(), ReceiverType, None,
|
||||
false);
|
||||
Actions.CodeCompleteObjCClassMessage(getCurScope(), ReceiverType,
|
||||
std::nullopt, false);
|
||||
else
|
||||
Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr,
|
||||
None, false);
|
||||
std::nullopt, false);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
|
@ -3540,9 +3540,8 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) {
|
|||
|
||||
// We have a valid expression. Collect it in a vector so we can
|
||||
// build the argument list.
|
||||
ObjCDictionaryElement Element = {
|
||||
KeyExpr.get(), ValueExpr.get(), EllipsisLoc, None
|
||||
};
|
||||
ObjCDictionaryElement Element = {KeyExpr.get(), ValueExpr.get(),
|
||||
EllipsisLoc, std::nullopt};
|
||||
Elements.push_back(Element);
|
||||
|
||||
if (!TryConsumeToken(tok::comma) && Tok.isNot(tok::r_brace))
|
||||
|
|
|
@ -1790,7 +1790,7 @@ parseOpenMPSimpleClause(Parser &P, OpenMPClauseKind Kind) {
|
|||
BalancedDelimiterTracker T(P, tok::l_paren, tok::annot_pragma_openmp_end);
|
||||
if (T.expectAndConsume(diag::err_expected_lparen_after,
|
||||
getOpenMPClauseName(Kind).data()))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
unsigned Type = getOpenMPSimpleClauseType(
|
||||
Kind, Tok.isAnnotation() ? "" : P.getPreprocessor().getSpelling(Tok),
|
||||
|
@ -2961,7 +2961,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
|
|||
DKind == OMPD_target_exit_data) {
|
||||
Actions.ActOnOpenMPRegionStart(DKind, getCurScope());
|
||||
AssociatedStmt = (Sema::CompoundScopeRAII(Actions),
|
||||
Actions.ActOnCompoundStmt(Loc, Loc, llvm::None,
|
||||
Actions.ActOnCompoundStmt(Loc, Loc, std::nullopt,
|
||||
/*isStmtExpr=*/false));
|
||||
AssociatedStmt = Actions.ActOnOpenMPRegionEnd(AssociatedStmt, Clauses);
|
||||
}
|
||||
|
|
|
@ -3203,7 +3203,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP,
|
|||
.Case("reassociate", TokFPAnnotValue::Reassociate)
|
||||
.Case("exceptions", TokFPAnnotValue::Exceptions)
|
||||
.Case("eval_method", TokFPAnnotValue::EvalMethod)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
if (!FlagKind) {
|
||||
PP.Diag(Tok.getLocation(), diag::err_pragma_fp_invalid_option)
|
||||
<< /*MissingOption=*/false << OptionInfo;
|
||||
|
@ -3236,7 +3236,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP,
|
|||
.Case("on", LangOptions::FPModeKind::FPM_On)
|
||||
.Case("off", LangOptions::FPModeKind::FPM_Off)
|
||||
.Case("fast", LangOptions::FPModeKind::FPM_Fast)
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
if (!AnnotValue->ContractValue) {
|
||||
PP.Diag(Tok.getLocation(), diag::err_pragma_fp_invalid_argument)
|
||||
<< PP.getSpelling(Tok) << OptionInfo->getName() << *FlagKind;
|
||||
|
@ -3248,7 +3248,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP,
|
|||
II->getName())
|
||||
.Case("on", LangOptions::FPModeKind::FPM_On)
|
||||
.Case("off", LangOptions::FPModeKind::FPM_Off)
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
if (!AnnotValue->ReassociateValue) {
|
||||
PP.Diag(Tok.getLocation(), diag::err_pragma_fp_invalid_argument)
|
||||
<< PP.getSpelling(Tok) << OptionInfo->getName() << *FlagKind;
|
||||
|
@ -3261,7 +3261,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP,
|
|||
.Case("ignore", LangOptions::FPE_Ignore)
|
||||
.Case("maytrap", LangOptions::FPE_MayTrap)
|
||||
.Case("strict", LangOptions::FPE_Strict)
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
if (!AnnotValue->ExceptionsValue) {
|
||||
PP.Diag(Tok.getLocation(), diag::err_pragma_fp_invalid_argument)
|
||||
<< PP.getSpelling(Tok) << OptionInfo->getName() << *FlagKind;
|
||||
|
@ -3274,7 +3274,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP,
|
|||
.Case("source", LangOptions::FPEvalMethodKind::FEM_Source)
|
||||
.Case("double", LangOptions::FPEvalMethodKind::FEM_Double)
|
||||
.Case("extended", LangOptions::FPEvalMethodKind::FEM_Extended)
|
||||
.Default(llvm::None);
|
||||
.Default(std::nullopt);
|
||||
if (!AnnotValue->EvalMethodValue) {
|
||||
PP.Diag(Tok.getLocation(), diag::err_pragma_fp_invalid_argument)
|
||||
<< PP.getSpelling(Tok) << OptionInfo->getName() << *FlagKind;
|
||||
|
|
|
@ -2451,7 +2451,8 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
|
|||
// If the function body could not be parsed, make a bogus compoundstmt.
|
||||
if (FnBody.isInvalid()) {
|
||||
Sema::CompoundScopeRAII CompoundScope(Actions);
|
||||
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, None, false);
|
||||
FnBody =
|
||||
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
|
||||
}
|
||||
|
||||
BodyScope.Exit();
|
||||
|
@ -2488,7 +2489,8 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
|
|||
// compound statement as the body.
|
||||
if (FnBody.isInvalid()) {
|
||||
Sema::CompoundScopeRAII CompoundScope(Actions);
|
||||
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, None, false);
|
||||
FnBody =
|
||||
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
|
||||
}
|
||||
|
||||
BodyScope.Exit();
|
||||
|
|
|
@ -341,8 +341,8 @@ Decl *Parser::ParseSingleDeclarationAfterTemplate(
|
|||
// Recover as if it were an explicit specialization.
|
||||
TemplateParameterLists FakedParamLists;
|
||||
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, None,
|
||||
LAngleLoc, nullptr));
|
||||
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
|
||||
std::nullopt, LAngleLoc, nullptr));
|
||||
|
||||
return ParseFunctionDefinition(
|
||||
DeclaratorInfo, ParsedTemplateInfo(&FakedParamLists,
|
||||
|
|
|
@ -917,7 +917,7 @@ Parser::ParseExternalDeclaration(ParsedAttributes &Attrs,
|
|||
if (CurParsedObjCImpl) {
|
||||
// Code-complete Objective-C methods even without leading '-'/'+' prefix.
|
||||
Actions.CodeCompleteObjCMethodDecl(getCurScope(),
|
||||
/*IsInstanceMethod=*/None,
|
||||
/*IsInstanceMethod=*/std::nullopt,
|
||||
/*ReturnType=*/nullptr);
|
||||
}
|
||||
Actions.CodeCompleteOrdinaryName(
|
||||
|
|
|
@ -2410,8 +2410,8 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) {
|
|||
Content,
|
||||
None,
|
||||
} Kind;
|
||||
llvm::Optional<int64_t> Old = llvm::None;
|
||||
llvm::Optional<int64_t> New = llvm::None;
|
||||
llvm::Optional<int64_t> Old = std::nullopt;
|
||||
llvm::Optional<int64_t> New = std::nullopt;
|
||||
};
|
||||
auto HasInputFileChanged = [&]() {
|
||||
if (StoredSize != File->getSize())
|
||||
|
@ -3966,13 +3966,13 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
|
|||
PP.getHeaderSearchInfo().lookupModule(F.ModuleName, F.ImportLoc);
|
||||
auto &Map = PP.getHeaderSearchInfo().getModuleMap();
|
||||
Optional<FileEntryRef> ModMap =
|
||||
M ? Map.getModuleMapFileForUniquing(M) : None;
|
||||
M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
|
||||
// Don't emit module relocation error if we have -fno-validate-pch
|
||||
if (!bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
|
||||
DisableValidationForModuleKind::Module) &&
|
||||
!ModMap) {
|
||||
if (!canRecoverFromOutOfDate(F.FileName, ClientLoadCapabilities)) {
|
||||
if (auto ASTFE = M ? M->getASTFile() : None) {
|
||||
if (auto ASTFE = M ? M->getASTFile() : std::nullopt) {
|
||||
// This module was defined by an imported (explicit) module.
|
||||
Diag(diag::err_module_file_conflict) << F.ModuleName << F.FileName
|
||||
<< ASTFE->getName();
|
||||
|
@ -6479,7 +6479,8 @@ static llvm::Optional<Type::TypeClass> getTypeClassForCode(TypeCode code) {
|
|||
#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
|
||||
case TYPE_##CODE_ID: return Type::CLASS_ID;
|
||||
#include "clang/Serialization/TypeBitCodes.def"
|
||||
default: return llvm::None;
|
||||
default:
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8778,7 +8779,7 @@ ASTReader::getSourceDescriptor(unsigned ID) {
|
|||
llvm::sys::path::parent_path(MF.FileName),
|
||||
FileName, MF.Signature);
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ExternalASTSource::ExtKind ASTReader::hasExternalDefinitions(const Decl *FD) {
|
||||
|
|
|
@ -1878,7 +1878,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) {
|
|||
// headers list when emitting resolved headers in the first loop below.
|
||||
// FIXME: It'd be preferable to avoid doing this if we were given
|
||||
// sufficient stat information in the module map.
|
||||
HS.getModuleMap().resolveHeaderDirectives(M, /*File=*/llvm::None);
|
||||
HS.getModuleMap().resolveHeaderDirectives(M, /*File=*/std::nullopt);
|
||||
|
||||
// If the file didn't exist, we can still create a module if we were given
|
||||
// enough information in the module map.
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace clang {
|
|||
return Common->PartialSpecializations;
|
||||
}
|
||||
ArrayRef<Decl> getPartialSpecializations(FunctionTemplateDecl::Common *) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<typename DeclTy>
|
||||
|
|
|
@ -445,7 +445,7 @@ void ModuleManager::visit(llvm::function_ref<bool(ModuleFile &M)> Visitor,
|
|||
bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize,
|
||||
time_t ExpectedModTime,
|
||||
Optional<FileEntryRef> &File) {
|
||||
File = None;
|
||||
File = std::nullopt;
|
||||
if (FileName == "-")
|
||||
return false;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ VScaleVal LMULType::getScale(unsigned ElementBitwidth) const {
|
|||
}
|
||||
// Illegal vscale result would be less than 1
|
||||
if (Log2ScaleResult < 0)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return 1 << Log2ScaleResult;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ Optional<PrototypeDescriptor> PrototypeDescriptor::parsePrototypeDescriptor(
|
|||
uint32_t Log2EEW;
|
||||
if (ComplexTT.second.getAsInteger(10, Log2EEW)) {
|
||||
llvm_unreachable("Invalid Log2EEW value!");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (Log2EEW) {
|
||||
case 3:
|
||||
|
@ -450,13 +450,13 @@ Optional<PrototypeDescriptor> PrototypeDescriptor::parsePrototypeDescriptor(
|
|||
break;
|
||||
default:
|
||||
llvm_unreachable("Invalid Log2EEW value, should be [3-6]");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
} else if (ComplexTT.first == "FixedSEW") {
|
||||
uint32_t NewSEW;
|
||||
if (ComplexTT.second.getAsInteger(10, NewSEW)) {
|
||||
llvm_unreachable("Invalid FixedSEW value!");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (NewSEW) {
|
||||
case 8:
|
||||
|
@ -473,13 +473,13 @@ Optional<PrototypeDescriptor> PrototypeDescriptor::parsePrototypeDescriptor(
|
|||
break;
|
||||
default:
|
||||
llvm_unreachable("Invalid FixedSEW value, should be 8, 16, 32 or 64");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
} else if (ComplexTT.first == "LFixedLog2LMUL") {
|
||||
int32_t Log2LMUL;
|
||||
if (ComplexTT.second.getAsInteger(10, Log2LMUL)) {
|
||||
llvm_unreachable("Invalid LFixedLog2LMUL value!");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (Log2LMUL) {
|
||||
case -3:
|
||||
|
@ -505,13 +505,13 @@ Optional<PrototypeDescriptor> PrototypeDescriptor::parsePrototypeDescriptor(
|
|||
break;
|
||||
default:
|
||||
llvm_unreachable("Invalid LFixedLog2LMUL value, should be [-3, 3]");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
} else if (ComplexTT.first == "SFixedLog2LMUL") {
|
||||
int32_t Log2LMUL;
|
||||
if (ComplexTT.second.getAsInteger(10, Log2LMUL)) {
|
||||
llvm_unreachable("Invalid SFixedLog2LMUL value!");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (Log2LMUL) {
|
||||
case -3:
|
||||
|
@ -537,7 +537,7 @@ Optional<PrototypeDescriptor> PrototypeDescriptor::parsePrototypeDescriptor(
|
|||
break;
|
||||
default:
|
||||
llvm_unreachable("Invalid LFixedLog2LMUL value, should be [-3, 3]");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -788,13 +788,13 @@ RVVTypeCache::computeTypes(BasicType BT, int Log2LMUL, unsigned NF,
|
|||
ArrayRef<PrototypeDescriptor> Prototype) {
|
||||
// LMUL x NF must be less than or equal to 8.
|
||||
if ((Log2LMUL >= 1) && (1 << Log2LMUL) * NF > 8)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
RVVTypes Types;
|
||||
for (const PrototypeDescriptor &Proto : Prototype) {
|
||||
auto T = computeType(BT, Log2LMUL, Proto);
|
||||
if (!T)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
// Record legal type index
|
||||
Types.push_back(T.value());
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ Optional<RVVTypePtr> RVVTypeCache::computeType(BasicType BT, int Log2LMUL,
|
|||
return &(It->second);
|
||||
|
||||
if (IllegalTypes.count(Idx))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
// Compute type and record the result.
|
||||
RVVType T(BT, Log2LMUL, Proto);
|
||||
|
@ -835,7 +835,7 @@ Optional<RVVTypePtr> RVVTypeCache::computeType(BasicType BT, int Log2LMUL,
|
|||
}
|
||||
// Record illegal type index.
|
||||
IllegalTypes.insert(Idx);
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -691,7 +691,7 @@ llvm::Optional<std::string> Node::getQualifiedIdentifier() const {
|
|||
if (ND->getDeclName().isIdentifier())
|
||||
return ND->getQualifiedNameAsString();
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
llvm::Optional<StringRef> Node::getIdentifier() const {
|
||||
|
@ -699,7 +699,7 @@ llvm::Optional<StringRef> Node::getIdentifier() const {
|
|||
if (ND->getDeclName().isIdentifier())
|
||||
return ND->getName();
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
StringRef WorkingDirectory, DependencyConsumer &Consumer,
|
||||
llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS,
|
||||
ScanningOutputFormat Format, bool OptimizeArgs, bool EagerLoadModules,
|
||||
bool DisableFree, llvm::Optional<StringRef> ModuleName = None)
|
||||
bool DisableFree, llvm::Optional<StringRef> ModuleName = std::nullopt)
|
||||
: WorkingDirectory(WorkingDirectory), Consumer(Consumer),
|
||||
DepFS(std::move(DepFS)), Format(Format), OptimizeArgs(OptimizeArgs),
|
||||
EagerLoadModules(EagerLoadModules), DisableFree(DisableFree),
|
||||
|
@ -219,7 +219,7 @@ public:
|
|||
if (llvm::ErrorOr<EntryRef> Entry =
|
||||
LocalDepFS->getOrCreateFileSystemEntry(File.getName()))
|
||||
return Entry->getDirectiveTokens();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -68,14 +68,14 @@ bool isSelfContainedHeader(const FileEntry *FE, const SourceManager &SM,
|
|||
llvm::Optional<StringRef> parseIWYUPragma(const char *Text) {
|
||||
// Skip the comment start, // or /*.
|
||||
if (Text[0] != '/' || (Text[1] != '/' && Text[1] != '*'))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
bool BlockComment = Text[1] == '*';
|
||||
Text += 2;
|
||||
|
||||
// Per spec, direcitves are whitespace- and case-sensitive.
|
||||
constexpr llvm::StringLiteral IWYUPragma = " IWYU pragma: ";
|
||||
if (strncmp(Text, IWYUPragma.data(), IWYUPragma.size()))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
Text += IWYUPragma.size();
|
||||
const char *End = Text;
|
||||
while (*End != 0 && *End != '\n')
|
||||
|
|
|
@ -58,7 +58,7 @@ unsigned getOffsetAfterTokenSequence(
|
|||
// (second) raw_identifier name is checked.
|
||||
bool checkAndConsumeDirectiveWithName(
|
||||
Lexer &Lex, StringRef Name, Token &Tok,
|
||||
llvm::Optional<StringRef> RawIDName = llvm::None) {
|
||||
llvm::Optional<StringRef> RawIDName = std::nullopt) {
|
||||
bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
|
||||
Tok.is(tok::raw_identifier) &&
|
||||
Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) &&
|
||||
|
@ -352,7 +352,7 @@ HeaderIncludes::insert(llvm::StringRef IncludeName, bool IsAngled) const {
|
|||
for (const auto &Inc : It->second)
|
||||
if ((IsAngled && StringRef(Inc.Name).startswith("<")) ||
|
||||
(!IsAngled && StringRef(Inc.Name).startswith("\"")))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
std::string Quoted =
|
||||
std::string(llvm::formatv(IsAngled ? "<{0}>" : "\"{0}\"", IncludeName));
|
||||
StringRef QuotedName = Quoted;
|
||||
|
|
|
@ -81,7 +81,7 @@ llvm::Optional<Header> Header::named(llvm::StringRef Name) {
|
|||
ensureInitialized();
|
||||
auto It = HeaderIDs->find(Name);
|
||||
if (It == HeaderIDs->end())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Header(It->second);
|
||||
}
|
||||
llvm::StringRef Header::name() const { return HeaderNames[ID]; }
|
||||
|
@ -95,7 +95,7 @@ llvm::Optional<Symbol> Symbol::named(llvm::StringRef Scope,
|
|||
if (It != NSSymbols->end())
|
||||
return Symbol(It->second);
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
Header Symbol::header() const { return Header(SymbolHeaderIDs[ID]); }
|
||||
llvm::SmallVector<Header> Symbol::headers() const {
|
||||
|
@ -137,7 +137,7 @@ llvm::Optional<Symbol> Recognizer::operator()(const Decl *D) {
|
|||
}
|
||||
NSSymbolMap *Symbols = namespaceSymbols(cast_or_null<NamespaceDecl>(DC));
|
||||
if (!Symbols)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
llvm::StringRef Name = [&]() -> llvm::StringRef {
|
||||
for (const auto *SymDC : llvm::reverse(IntermediateDecl)) {
|
||||
|
@ -153,11 +153,11 @@ llvm::Optional<Symbol> Recognizer::operator()(const Decl *D) {
|
|||
return "";
|
||||
}();
|
||||
if (Name.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
auto It = Symbols->find(Name);
|
||||
if (It == Symbols->end())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Symbol(It->second);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ struct TransferableCommand {
|
|||
Type = foldType(*Type);
|
||||
// The contract is to store None instead of TY_INVALID.
|
||||
if (Type == types::TY_INVALID)
|
||||
Type = llvm::None;
|
||||
Type = std::nullopt;
|
||||
}
|
||||
|
||||
// Produce a CompileCommand for \p filename, based on this one.
|
||||
|
@ -291,7 +291,7 @@ private:
|
|||
if (Opt.matches(driver::options::OPT_x))
|
||||
return types::lookupTypeForTypeSpecifier(Arg.getValue());
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Try to interpret the argument as '-std='.
|
||||
|
@ -299,7 +299,7 @@ private:
|
|||
using namespace driver::options;
|
||||
if (Arg.getOption().matches(ClangCLMode ? OPT__SLASH_std : OPT_std_EQ))
|
||||
return LangStandard::getLangKind(Arg.getValue());
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
SelectedASTNode Result = std::move(SelectionStack.back());
|
||||
SelectionStack.pop_back();
|
||||
if (Result.Children.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return std::move(Result);
|
||||
}
|
||||
|
||||
|
@ -380,17 +380,17 @@ CodeRangeASTSelection::create(SourceRange SelectionRange,
|
|||
const SelectedASTNode &ASTSelection) {
|
||||
// Code range is selected when the selection range is not empty.
|
||||
if (SelectionRange.getBegin() == SelectionRange.getEnd())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
llvm::SmallVector<SelectedNodeWithParents, 4> ContainSelection;
|
||||
findDeepestWithKind(ASTSelection, ContainSelection,
|
||||
SourceSelectionKind::ContainsSelection);
|
||||
// We are looking for a selection in one body of code, so let's focus on
|
||||
// one matching result.
|
||||
if (ContainSelection.size() != 1)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
SelectedNodeWithParents &Selected = ContainSelection[0];
|
||||
if (!Selected.Node.get().Node.get<Stmt>())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
const Stmt *CodeRangeStmt = Selected.Node.get().Node.get<Stmt>();
|
||||
if (!isa<CompoundStmt>(CodeRangeStmt)) {
|
||||
Selected.canonicalize();
|
||||
|
|
|
@ -457,7 +457,7 @@ TokenBuffer::spelledForExpanded(llvm::ArrayRef<syntax::Token> Expanded) const {
|
|||
// Mapping an empty range is ambiguous in case of empty mappings at either end
|
||||
// of the range, bail out in that case.
|
||||
if (Expanded.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
const syntax::Token *First = &Expanded.front();
|
||||
const syntax::Token *Last = &Expanded.back();
|
||||
auto [FirstSpelled, FirstMapping] = spelledForExpandedToken(First);
|
||||
|
@ -466,7 +466,7 @@ TokenBuffer::spelledForExpanded(llvm::ArrayRef<syntax::Token> Expanded) const {
|
|||
FileID FID = SourceMgr->getFileID(FirstSpelled->location());
|
||||
// FIXME: Handle multi-file changes by trying to map onto a common root.
|
||||
if (FID != SourceMgr->getFileID(LastSpelled->location()))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
const MarkedFile &File = Files.find(FID)->second;
|
||||
|
||||
|
@ -485,7 +485,7 @@ TokenBuffer::spelledForExpanded(llvm::ArrayRef<syntax::Token> Expanded) const {
|
|||
SourceRange Range = spelledForExpandedSlow(
|
||||
First->location(), Last->location(), Prev, Next, FID, *SourceMgr);
|
||||
if (Range.isInvalid())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return getTokensCovering(File.SpelledTokens, Range, *SourceMgr);
|
||||
}
|
||||
|
||||
|
@ -494,9 +494,9 @@ TokenBuffer::spelledForExpanded(llvm::ArrayRef<syntax::Token> Expanded) const {
|
|||
unsigned FirstExpanded = Expanded.begin() - ExpandedTokens.data();
|
||||
unsigned LastExpanded = Expanded.end() - ExpandedTokens.data();
|
||||
if (FirstMapping && FirstExpanded != FirstMapping->BeginExpanded)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (LastMapping && LastMapping->EndExpanded != LastExpanded)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return llvm::makeArrayRef(
|
||||
FirstMapping ? File.SpelledTokens.data() + FirstMapping->BeginSpelled
|
||||
: FirstSpelled,
|
||||
|
@ -543,7 +543,7 @@ TokenBuffer::expansionStartingAt(const syntax::Token *Spelled) const {
|
|||
return M.BeginSpelled < SpelledIndex;
|
||||
});
|
||||
if (M == File.Mappings.end() || M->BeginSpelled != SpelledIndex)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return makeExpansion(File, *M);
|
||||
}
|
||||
|
||||
|
@ -806,7 +806,7 @@ private:
|
|||
// In the simplest case, skips spelled tokens until finding one that produced
|
||||
// the NextExpanded token, and creates an empty mapping for them.
|
||||
// If Drain is provided, skips remaining tokens from that file instead.
|
||||
void discard(llvm::Optional<FileID> Drain = llvm::None) {
|
||||
void discard(llvm::Optional<FileID> Drain = std::nullopt) {
|
||||
SourceLocation Target =
|
||||
Drain ? SM.getLocForEndOfFile(*Drain)
|
||||
: SM.getExpansionLoc(
|
||||
|
|
|
@ -124,7 +124,7 @@ llvm::Optional<Element> findOptional(const llvm::StringMap<Element> &Map,
|
|||
llvm::StringRef Key) {
|
||||
auto it = Map.find(Key);
|
||||
if (it == Map.end())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ static ExpectedProgress<std::nullopt_t> parseChar(char c, ParseState State) {
|
|||
if (State.Input.empty() || State.Input.front() != c)
|
||||
return makeParseError(State,
|
||||
("expected char not found: " + llvm::Twine(c)).str());
|
||||
return makeParseProgress(advance(State, 1), llvm::None);
|
||||
return makeParseProgress(advance(State, 1), std::nullopt);
|
||||
}
|
||||
|
||||
// Parses an identitifer "token" -- handles preceding whitespace.
|
||||
|
|
|
@ -96,7 +96,7 @@ clang::tooling::getRangeForEdit(const CharSourceRange &EditRange,
|
|||
CharSourceRange Range = Lexer::makeFileCharRange(EditRange, SM, LangOpts);
|
||||
bool IsInvalid = llvm::errorToBool(validateEditRange(Range, SM));
|
||||
if (IsInvalid)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Range;
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ llvm::Optional<std::string> tooling::buildParens(const Expr &E,
|
|||
const ASTContext &Context) {
|
||||
StringRef Text = getText(E, Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (mayEverNeedParens(E))
|
||||
return ("(" + Text + ")").str();
|
||||
return Text.str();
|
||||
|
@ -90,13 +90,13 @@ tooling::buildDereference(const Expr &E, const ASTContext &Context) {
|
|||
StringRef Text =
|
||||
getText(*Op->getSubExpr()->IgnoreParenImpCasts(), Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Text.str();
|
||||
}
|
||||
|
||||
StringRef Text = getText(E, Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
// Add leading '*'.
|
||||
if (needParensAfterUnaryOperator(E))
|
||||
return ("*(" + Text + ")").str();
|
||||
|
@ -113,13 +113,13 @@ llvm::Optional<std::string> tooling::buildAddressOf(const Expr &E,
|
|||
StringRef Text =
|
||||
getText(*Op->getSubExpr()->IgnoreParenImpCasts(), Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return Text.str();
|
||||
}
|
||||
// Add leading '&'.
|
||||
StringRef Text = getText(E, Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (needParensAfterUnaryOperator(E)) {
|
||||
return ("&(" + Text + ")").str();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ buildAccessForValue(const Expr &E, const ASTContext &Context) {
|
|||
const Expr *SubExpr = Op->getSubExpr()->IgnoreParenImpCasts();
|
||||
StringRef DerefText = getText(*SubExpr, Context);
|
||||
if (DerefText.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (needParensBeforeDotOrArrow(*SubExpr))
|
||||
return ("(" + DerefText + ")->").str();
|
||||
return (DerefText + "->").str();
|
||||
|
@ -145,7 +145,7 @@ buildAccessForValue(const Expr &E, const ASTContext &Context) {
|
|||
// Add following '.'.
|
||||
StringRef Text = getText(E, Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (needParensBeforeDotOrArrow(E)) {
|
||||
return ("(" + Text + ").").str();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ buildAccessForPointer(const Expr &E, const ASTContext &Context) {
|
|||
const Expr *SubExpr = Op->getSubExpr()->IgnoreParenImpCasts();
|
||||
StringRef DerefText = getText(*SubExpr, Context);
|
||||
if (DerefText.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (needParensBeforeDotOrArrow(*SubExpr))
|
||||
return ("(" + DerefText + ").").str();
|
||||
return (DerefText + ".").str();
|
||||
|
@ -171,7 +171,7 @@ buildAccessForPointer(const Expr &E, const ASTContext &Context) {
|
|||
// Add following '->'.
|
||||
StringRef Text = getText(E, Context);
|
||||
if (Text.empty())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
if (needParensBeforeDotOrArrow(E))
|
||||
return ("(" + Text + ")->").str();
|
||||
return (Text + "->").str();
|
||||
|
|
|
@ -1237,7 +1237,7 @@ Optional<std::string> findFile(StringRef Dir, StringRef Root,
|
|||
|
||||
if (sys::fs::exists(Path))
|
||||
return static_cast<std::string>(Path);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<std::string> findFromSearchPaths(StringRef Name, StringRef Root,
|
||||
|
@ -1245,7 +1245,7 @@ Optional<std::string> findFromSearchPaths(StringRef Name, StringRef Root,
|
|||
for (StringRef Dir : SearchPaths)
|
||||
if (Optional<std::string> File = findFile(Dir, Root, Name))
|
||||
return File;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<std::string> searchLibraryBaseName(StringRef Name, StringRef Root,
|
||||
|
@ -1256,7 +1256,7 @@ Optional<std::string> searchLibraryBaseName(StringRef Name, StringRef Root,
|
|||
if (Optional<std::string> File = findFile(Dir, Root, "lib" + Name + ".a"))
|
||||
return File;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Search for static libraries in the linker's library path given input like
|
||||
|
|
|
@ -200,7 +200,7 @@ public:
|
|||
Value = CLOpt.getValue();
|
||||
return;
|
||||
}
|
||||
Value = None;
|
||||
Value = std::nullopt;
|
||||
if (Opt.isRequired())
|
||||
MissingRequiredOptions.push_back(&Opt);
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ findTestSelectionRanges(StringRef Filename) {
|
|||
if (!ErrOrFile) {
|
||||
llvm::errs() << "error: -selection=test:" << Filename
|
||||
<< " : could not open the given file";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
StringRef Source = ErrOrFile.get()->getBuffer();
|
||||
|
||||
|
@ -340,7 +340,7 @@ findTestSelectionRanges(StringRef Filename) {
|
|||
// Allow CHECK: comments to contain range= commands.
|
||||
if (!RangeRegex.match(Comment, &Matches) || Comment.contains("CHECK")) {
|
||||
if (DetectMistypedCommand())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
continue;
|
||||
}
|
||||
unsigned Offset = Tok.getEndLoc().getRawEncoding();
|
||||
|
@ -359,7 +359,7 @@ findTestSelectionRanges(StringRef Filename) {
|
|||
SmallVector<StringRef, 4> EndLocMatches;
|
||||
if (!EndLocRegex.match(Matches[3], &EndLocMatches)) {
|
||||
if (DetectMistypedCommand())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
continue;
|
||||
}
|
||||
unsigned EndLineOffset = 0, EndColumn = 0;
|
||||
|
@ -380,7 +380,7 @@ findTestSelectionRanges(StringRef Filename) {
|
|||
if (GroupedRanges.empty()) {
|
||||
llvm::errs() << "error: -selection=test:" << Filename
|
||||
<< ": no 'range' commands";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
TestSelectionRangesInFile TestRanges = {Filename.str(), {}};
|
||||
|
|
|
@ -33,7 +33,7 @@ findDiagnostic(ArrayRef<DiagnosticRecord> Diagnostics, StringRef Name) {
|
|||
if (DiagName == Name)
|
||||
return Diag;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
int FindDiagnosticID::run(unsigned int argc, char **argv,
|
||||
|
|
|
@ -177,7 +177,8 @@ static int PrintSupportedCPUs(std::string TargetStr) {
|
|||
// the target machine will handle the mcpu printing
|
||||
llvm::TargetOptions Options;
|
||||
std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
|
||||
TheTarget->createTargetMachine(TargetStr, "", "+cpuhelp", Options, None));
|
||||
TheTarget->createTargetMachine(TargetStr, "", "+cpuhelp", Options,
|
||||
std::nullopt));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ generateReproducerForInvocationArguments(ArrayRef<const char *> Argv,
|
|||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string GetExecutablePath(const char *Argv0, bool CanonicalPrefixes);
|
||||
|
|
|
@ -497,7 +497,7 @@ int clang_main(int Argc, char **Argv) {
|
|||
.Case("crash", Driver::ReproLevel::OnCrash)
|
||||
.Case("error", Driver::ReproLevel::OnError)
|
||||
.Case("always", Driver::ReproLevel::Always)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
if (!Level) {
|
||||
llvm::errs() << "Unknown value for " << A->getSpelling() << ": '"
|
||||
<< A->getValue() << "'\n";
|
||||
|
|
|
@ -604,12 +604,12 @@ Optional<bool> CursorVisitor::shouldVisitCursor(CXCursor Cursor) {
|
|||
if (RegionOfInterest.isValid()) {
|
||||
SourceRange Range = getFullCursorExtent(Cursor, AU->getSourceManager());
|
||||
if (Range.isInvalid())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
switch (CompareRegionOfInterest(Range)) {
|
||||
case RangeBefore:
|
||||
// This declaration comes before the region of interest; skip it.
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
case RangeAfter:
|
||||
// This declaration comes after the region of interest; we're done.
|
||||
|
@ -658,7 +658,7 @@ Optional<bool> CursorVisitor::handleDeclForVisitation(const Decl *D) {
|
|||
// we passed the region-of-interest.
|
||||
if (auto *ivarD = dyn_cast<ObjCIvarDecl>(D)) {
|
||||
if (ivarD->getSynthesize())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// FIXME: ObjCClassRef/ObjCProtocolRef for forward class/protocol
|
||||
|
@ -676,12 +676,12 @@ Optional<bool> CursorVisitor::handleDeclForVisitation(const Decl *D) {
|
|||
|
||||
const Optional<bool> V = shouldVisitCursor(Cursor);
|
||||
if (!V)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
if (!V.value())
|
||||
return false;
|
||||
if (Visit(Cursor, true))
|
||||
return true;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool CursorVisitor::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
|
||||
|
@ -3881,7 +3881,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
|
|||
|
||||
LibclangInvocationReporter InvocationReporter(
|
||||
*CXXIdx, LibclangInvocationReporter::OperationKind::ParseOperation,
|
||||
options, llvm::makeArrayRef(*Args), /*InvocationArgs=*/None,
|
||||
options, llvm::makeArrayRef(*Args), /*InvocationArgs=*/std::nullopt,
|
||||
unsaved_files);
|
||||
std::unique_ptr<ASTUnit> Unit(ASTUnit::LoadFromCommandLine(
|
||||
Args->data(), Args->data() + Args->size(),
|
||||
|
|
|
@ -193,13 +193,13 @@ GetTemplateArguments(QualType Type) {
|
|||
return TemplateDecl->getTemplateArgs().asArray();
|
||||
}
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<QualType> TemplateArgumentToQualType(const TemplateArgument &A) {
|
||||
if (A.getKind() == TemplateArgument::Type)
|
||||
return A.getAsType();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<QualType>
|
||||
|
@ -216,7 +216,7 @@ FindTemplateArgumentTypeAt(ArrayRef<TemplateArgument> TA, unsigned index) {
|
|||
return TemplateArgumentToQualType(A);
|
||||
current++;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
CXType clang_getCursorType(CXCursor C) {
|
||||
|
|
|
@ -1651,7 +1651,7 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){
|
|||
std::make_unique<Rev>(Arg1.first.getElementSizeInBits()));
|
||||
ST.addExpander("MaskExpand",
|
||||
std::make_unique<MaskExpander>(Arg1.first.getNumElements()));
|
||||
ST.evaluate(DI->getArg(2), Elts, None);
|
||||
ST.evaluate(DI->getArg(2), Elts, std::nullopt);
|
||||
|
||||
std::string S = "__builtin_shufflevector(" + Arg1.second + ", " + Arg2.second;
|
||||
for (auto &E : Elts) {
|
||||
|
|
Loading…
Reference in New Issue