diff --git a/clang/include/clang/AST/CommentSema.h b/clang/include/clang/AST/CommentSema.h index 03f13283ac0d9..916d7945329c5 100644 --- a/clang/include/clang/AST/CommentSema.h +++ b/clang/include/clang/AST/CommentSema.h @@ -80,7 +80,7 @@ class Sema { ArrayRef copyArray(ArrayRef Source) { if (!Source.empty()) return Source.copy(Allocator); - return std::nullopt; + return {}; } ParagraphComment *actOnParagraphComment( diff --git a/clang/include/clang/AST/DeclFriend.h b/clang/include/clang/AST/DeclFriend.h index 095f14a81fd57..1578580c89cd8 100644 --- a/clang/include/clang/AST/DeclFriend.h +++ b/clang/include/clang/AST/DeclFriend.h @@ -115,7 +115,7 @@ class FriendDecl final static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, SourceLocation EllipsisLoc = {}, - ArrayRef FriendTypeTPLists = std::nullopt); + ArrayRef FriendTypeTPLists = {}); static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned FriendTypeNumTPLists); diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 1cda70530d7d8..4663603f79754 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -386,7 +386,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { /// If the method is implicit (not coming from source) \p SelLocs is /// ignored. void setMethodParams(ASTContext &C, ArrayRef Params, - ArrayRef SelLocs = std::nullopt); + ArrayRef SelLocs = {}); // Iterator access to parameter types. struct GetTypeFn { diff --git a/clang/include/clang/AST/DeclOpenMP.h b/clang/include/clang/AST/DeclOpenMP.h index 868662208efa1..cf383889c0ad9 100644 --- a/clang/include/clang/AST/DeclOpenMP.h +++ b/clang/include/clang/AST/DeclOpenMP.h @@ -34,7 +34,7 @@ template class OMPDeclarativeDirective : public U { /// Get the clauses storage. MutableArrayRef getClauses() { if (!Data) - return std::nullopt; + return {}; return Data->getClauses(); } @@ -90,7 +90,7 @@ template class OMPDeclarativeDirective : public U { ArrayRef clauses() const { if (!Data) - return std::nullopt; + return {}; return Data->getClauses(); } }; diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index cfe3938f83847..57ab94bcb2010 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -4306,11 +4306,11 @@ class SizeOfPackExpr final : Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {} public: - static SizeOfPackExpr * - Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, - SourceLocation PackLoc, SourceLocation RParenLoc, - std::optional Length = std::nullopt, - ArrayRef PartialArgs = std::nullopt); + static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc, + NamedDecl *Pack, SourceLocation PackLoc, + SourceLocation RParenLoc, + std::optional Length = std::nullopt, + ArrayRef PartialArgs = {}); static SizeOfPackExpr *CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs); diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index 2e48c1c3c72c8..9cf46f73f6e46 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -6108,14 +6108,14 @@ class OMPMappableExprListClause : public OMPVarListClause, return const_component_lists_iterator( getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(), getComponentsRef(), SupportsMapper, - SupportsMapper ? getUDMapperRefs() : std::nullopt); + SupportsMapper ? getUDMapperRefs() : ArrayRef()); } const_component_lists_iterator component_lists_end() const { return const_component_lists_iterator( ArrayRef(), ArrayRef(), ArrayRef(), MappableExprComponentListRef(getComponentsRef().end(), getComponentsRef().end()), - SupportsMapper, std::nullopt); + SupportsMapper, {}); } const_component_lists_range component_lists() const { return {component_lists_begin(), component_lists_end()}; @@ -6128,7 +6128,7 @@ class OMPMappableExprListClause : public OMPVarListClause, return const_component_lists_iterator( VD, getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(), getComponentsRef(), SupportsMapper, - SupportsMapper ? getUDMapperRefs() : std::nullopt); + SupportsMapper ? getUDMapperRefs() : ArrayRef()); } const_component_lists_iterator decl_component_lists_end() const { return component_lists_end(); diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index 930670d17f2d1..9ec49b8683dc8 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -277,7 +277,7 @@ class OMPExecutableDirective : public Stmt { /// Get the clauses storage. MutableArrayRef getClauses() { if (!Data) - return std::nullopt; + return {}; return Data->getClauses(); } @@ -572,7 +572,7 @@ class OMPExecutableDirective : public Stmt { ArrayRef clauses() const { if (!Data) - return std::nullopt; + return {}; return Data->getClauses(); } diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h index 0eaa4b0eedb35..a8f0263d5505a 100644 --- a/clang/include/clang/AST/TemplateBase.h +++ b/clang/include/clang/AST/TemplateBase.h @@ -283,7 +283,7 @@ class TemplateArgument { } static TemplateArgument getEmptyPack() { - return TemplateArgument(std::nullopt); + return TemplateArgument(ArrayRef()); } /// Create a new template argument pack by copying the given set of diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index c1cc63fdb7433..ab8b146453e76 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -121,7 +121,7 @@ template struct TypeListContainsSuperOf { template )> struct VariadicFunction { - ResultT operator()() const { return Func(std::nullopt); } + ResultT operator()() const { return Func({}); } template ResultT operator()(const ArgT &Arg1, const ArgsT &... Args) const { @@ -1949,35 +1949,35 @@ inline ArrayRef getTemplateSpecializationArgs(const FunctionDecl &FD) { if (const auto* TemplateArgs = FD.getTemplateSpecializationArgs()) return TemplateArgs->asArray(); - return std::nullopt; + return {}; } inline ArrayRef getTemplateArgsWritten(const ClassTemplateSpecializationDecl &D) { if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten()) return Args->arguments(); - return std::nullopt; + return {}; } inline ArrayRef getTemplateArgsWritten(const VarTemplateSpecializationDecl &D) { if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten()) return Args->arguments(); - return std::nullopt; + return {}; } inline ArrayRef getTemplateArgsWritten(const FunctionDecl &FD) { if (const auto *Args = FD.getTemplateSpecializationArgsAsWritten()) return Args->arguments(); - return std::nullopt; + return {}; } inline ArrayRef getTemplateArgsWritten(const DeclRefExpr &DRE) { if (const auto *Args = DRE.getTemplateArgs()) return {Args, DRE.getNumTemplateArgs()}; - return std::nullopt; + return {}; } inline SmallVector diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h index 65dd66ee093fe..2f202607bd3fa 100644 --- a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h +++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h @@ -1470,7 +1470,7 @@ class Return : public Terminator { static bool classof(const SExpr *E) { return E->opcode() == COP_Return; } /// Return an empty list. - ArrayRef successors() { return std::nullopt; } + ArrayRef successors() { return {}; } SExpr *returnValue() { return Retval; } const SExpr *returnValue() const { return Retval; } @@ -1496,7 +1496,7 @@ inline ArrayRef Terminator::successors() { case COP_Branch: return cast(this)->successors(); case COP_Return: return cast(this)->successors(); default: - return std::nullopt; + return {}; } } diff --git a/clang/include/clang/Analysis/AnyCall.h b/clang/include/clang/Analysis/AnyCall.h index 48abce062d133..3e95366c98595 100644 --- a/clang/include/clang/Analysis/AnyCall.h +++ b/clang/include/clang/Analysis/AnyCall.h @@ -143,7 +143,7 @@ class AnyCall { /// \returns formal parameters for direct calls (including virtual calls) ArrayRef parameters() const { if (!D) - return std::nullopt; + return {}; if (const auto *FD = dyn_cast(D)) { return FD->parameters(); @@ -152,7 +152,7 @@ class AnyCall { } else if (const auto *BD = dyn_cast(D)) { return BD->parameters(); } else { - return std::nullopt; + return {}; } } diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index e7469e1e98912..17262d5968b12 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -1858,11 +1858,9 @@ class TargetInfo : public TransferrableTargetInfo, } virtual ArrayRef getGCCRegNames() const = 0; virtual ArrayRef getGCCRegAliases() const = 0; - virtual ArrayRef getGCCAddlRegNames() const { - return std::nullopt; - } + virtual ArrayRef getGCCAddlRegNames() const { return {}; } - private: +private: // Assert the values for the fractional and integral bits for each fixed point // type follow the restrictions given in clause 6.2.6.3 of N1169. void CheckFixedPointBits() const; diff --git a/clang/include/clang/Driver/Job.h b/clang/include/clang/Driver/Job.h index df9449463c53b..561866197b780 100644 --- a/clang/include/clang/Driver/Job.h +++ b/clang/include/clang/Driver/Job.h @@ -172,8 +172,7 @@ class Command { Command(const Action &Source, const Tool &Creator, ResponseFileSupport ResponseSupport, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef Inputs, - ArrayRef Outputs = std::nullopt, - const char *PrependArg = nullptr); + ArrayRef Outputs = {}, const char *PrependArg = nullptr); // FIXME: This really shouldn't be copyable, but is currently copied in some // error handling in Driver::generateCompilationDiagnostics. Command(const Command &) = default; @@ -245,8 +244,7 @@ class CC1Command : public Command { CC1Command(const Action &Source, const Tool &Creator, ResponseFileSupport ResponseSupport, const char *Executable, const llvm::opt::ArgStringList &Arguments, - ArrayRef Inputs, - ArrayRef Outputs = std::nullopt, + ArrayRef Inputs, ArrayRef Outputs = {}, const char *PrependArg = nullptr); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index 8cefae8587aa3..1f98c6ab328ba 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -836,7 +836,7 @@ class ASTUnit { bool StorePreamblesInMemory = false, StringRef PreambleStoragePath = StringRef(), bool OnlyLocalDecls = false, CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, - ArrayRef RemappedFiles = std::nullopt, + ArrayRef RemappedFiles = {}, bool RemappedFilesKeepOriginalName = true, unsigned PrecompilePreambleAfterNParses = 0, TranslationUnitKind TUKind = TU_Complete, @@ -864,7 +864,7 @@ class ASTUnit { /// \returns True if a failure occurred that causes the ASTUnit not to /// contain any translation-unit information, false otherwise. bool Reparse(std::shared_ptr PCHContainerOps, - ArrayRef RemappedFiles = std::nullopt, + ArrayRef RemappedFiles = {}, IntrusiveRefCntPtr VFS = nullptr); /// Free data that will be re-generated on the next parse. diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 92749e4de44b5..f3f4de044fc41 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -911,7 +911,7 @@ class Preprocessor { getActiveModuleMacros(Preprocessor &PP, const IdentifierInfo *II) const { if (auto *Info = getModuleInfo(PP, II)) return Info->ActiveModuleMacros; - return std::nullopt; + return {}; } MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc, @@ -935,7 +935,7 @@ class Preprocessor { ArrayRef getOverriddenMacros() const { if (auto *Info = State.dyn_cast()) return Info->OverriddenMacros; - return std::nullopt; + return {}; } void setOverriddenMacros(Preprocessor &PP, @@ -1444,7 +1444,7 @@ class Preprocessor { auto I = LeafModuleMacros.find(II); if (I != LeafModuleMacros.end()) return I->second; - return std::nullopt; + return {}; } /// Get the list of submodules that we're currently building. diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 0924dc27af82b..2dd27593778c7 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -375,12 +375,11 @@ class CodeCompletionContext { public: /// Construct a new code-completion context of the given kind. CodeCompletionContext(Kind CCKind) - : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(std::nullopt) {} + : CCKind(CCKind), IsUsingDeclaration(false), SelIdents() {} /// Construct a new code-completion context of the given kind. - CodeCompletionContext( - Kind CCKind, QualType T, - ArrayRef SelIdents = std::nullopt) + CodeCompletionContext(Kind CCKind, QualType T, + ArrayRef SelIdents = {}) : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(SelIdents) { if (CCKind == CCC_DotMemberAccess || CCKind == CCC_ArrowMemberAccess || CCKind == CCC_ObjCPropertyAccess || CCKind == CCC_ObjCClassMessage || diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index c716a25bb673b..58fa64c80a16f 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -1206,9 +1206,8 @@ class Sema; /// Add a new candidate with NumConversions conversion sequence slots /// to the overload set. - OverloadCandidate & - addCandidate(unsigned NumConversions = 0, - ConversionSequenceList Conversions = std::nullopt) { + OverloadCandidate &addCandidate(unsigned NumConversions = 0, + ConversionSequenceList Conversions = {}) { assert((Conversions.empty() || Conversions.size() == NumConversions) && "preallocated conversion sequence has wrong length"); diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index bc9c422ed4c47..8f93b549827e9 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -3478,10 +3478,12 @@ class Sema final : public SemaBase { /// a C++0x [dcl.typedef]p2 alias-declaration: 'using T = A;'. NamedDecl *ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration); - NamedDecl *ActOnVariableDeclarator( - Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, - LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, - bool &AddToScope, ArrayRef Bindings = std::nullopt); + NamedDecl *ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, + TypeSourceInfo *TInfo, + LookupResult &Previous, + MultiTemplateParamsArg TemplateParamLists, + bool &AddToScope, + ArrayRef Bindings = {}); /// Perform semantic checking on a newly-created variable /// declaration. @@ -5325,9 +5327,8 @@ class Sema final : public SemaBase { bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer); - bool SetCtorInitializers( - CXXConstructorDecl *Constructor, bool AnyErrors, - ArrayRef Initializers = std::nullopt); + bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, + ArrayRef Initializers = {}); /// MarkBaseAndMemberDestructorsReferenced - Given a record decl, /// mark all the non-trivial destructors of its members and bases as @@ -6623,9 +6624,9 @@ class Sema final : public SemaBase { /// \param SkipLocalVariables If true, don't mark local variables as /// 'referenced'. /// \param StopAt Subexpressions that we shouldn't recurse into. - void MarkDeclarationsReferencedInExpr( - Expr *E, bool SkipLocalVariables = false, - ArrayRef StopAt = std::nullopt); + void MarkDeclarationsReferencedInExpr(Expr *E, + bool SkipLocalVariables = false, + ArrayRef StopAt = {}); /// Try to convert an expression \p E to type \p Ty. Returns the result of the /// conversion. @@ -6696,7 +6697,7 @@ class Sema final : public SemaBase { DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr, - ArrayRef Args = std::nullopt, + ArrayRef Args = {}, DeclContext *LookupCtx = nullptr, TypoExpr **Out = nullptr); @@ -10124,15 +10125,17 @@ class Sema final : public SemaBase { /// \param PartialOverloading true if we are performing "partial" overloading /// based on an incomplete set of function arguments. This feature is used by /// code completion. - void AddOverloadCandidate( - FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef Args, - OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false, - bool PartialOverloading = false, bool AllowExplicit = true, - bool AllowExplicitConversion = false, - ADLCallKind IsADLCandidate = ADLCallKind::NotADL, - ConversionSequenceList EarlyConversions = std::nullopt, - OverloadCandidateParamOrder PO = {}, - bool AggregateCandidateDeduction = false); + void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, + ArrayRef Args, + OverloadCandidateSet &CandidateSet, + bool SuppressUserConversions = false, + bool PartialOverloading = false, + bool AllowExplicit = true, + bool AllowExplicitConversion = false, + ADLCallKind IsADLCandidate = ADLCallKind::NotADL, + ConversionSequenceList EarlyConversions = {}, + OverloadCandidateParamOrder PO = {}, + bool AggregateCandidateDeduction = false); /// Add all of the function declarations in the given function set to /// the overload candidate set. @@ -10159,15 +10162,15 @@ class Sema final : public SemaBase { /// both @c a1 and @c a2. If @p SuppressUserConversions, then don't /// allow user-defined conversions via constructors or conversion /// operators. - void - AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, - CXXRecordDecl *ActingContext, QualType ObjectType, - Expr::Classification ObjectClassification, - ArrayRef Args, OverloadCandidateSet &CandidateSet, - bool SuppressUserConversions = false, - bool PartialOverloading = false, - ConversionSequenceList EarlyConversions = std::nullopt, - OverloadCandidateParamOrder PO = {}); + void AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, + CXXRecordDecl *ActingContext, QualType ObjectType, + Expr::Classification ObjectClassification, + ArrayRef Args, + OverloadCandidateSet &CandidateSet, + bool SuppressUserConversions = false, + bool PartialOverloading = false, + ConversionSequenceList EarlyConversions = {}, + OverloadCandidateParamOrder PO = {}); /// Add a C++ member function template as a candidate to the candidate /// set, using template argument deduction to produce an appropriate member @@ -12968,12 +12971,13 @@ class Sema final : public SemaBase { bool CheckInstantiationDepth(SourceLocation PointOfInstantiation, SourceRange InstantiationRange); - InstantiatingTemplate( - Sema &SemaRef, CodeSynthesisContext::SynthesisKind Kind, - SourceLocation PointOfInstantiation, SourceRange InstantiationRange, - Decl *Entity, NamedDecl *Template = nullptr, - ArrayRef TemplateArgs = std::nullopt, - sema::TemplateDeductionInfo *DeductionInfo = nullptr); + InstantiatingTemplate(Sema &SemaRef, + CodeSynthesisContext::SynthesisKind Kind, + SourceLocation PointOfInstantiation, + SourceRange InstantiationRange, Decl *Entity, + NamedDecl *Template = nullptr, + ArrayRef TemplateArgs = {}, + sema::TemplateDeductionInfo *DeductionInfo = nullptr); InstantiatingTemplate(const InstantiatingTemplate &) = delete; diff --git a/clang/include/clang/Sema/SemaObjC.h b/clang/include/clang/Sema/SemaObjC.h index 9367c680953f7..1332eb4f4d423 100644 --- a/clang/include/clang/Sema/SemaObjC.h +++ b/clang/include/clang/Sema/SemaObjC.h @@ -336,8 +336,8 @@ class SemaObjC : public SemaBase { ObjCInterfaceDecl *ID); Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd, - ArrayRef allMethods = std::nullopt, - ArrayRef allTUVars = std::nullopt); + ArrayRef allMethods = {}, + ArrayRef allTUVars = {}); struct ObjCArgInfo { IdentifierInfo *Name; diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h index d6e56f85e2d54..a34551f6b5a19 100644 --- a/clang/include/clang/Sema/SemaOpenACC.h +++ b/clang/include/clang/Sema/SemaOpenACC.h @@ -274,7 +274,7 @@ class SemaOpenACC : public SemaBase { "Parsed clause kind does not have a queue id expr list"); if (std::holds_alternative(Details)) - return ArrayRef{std::nullopt}; + return ArrayRef(); return std::get(Details).QueueIdExprs; } diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h index 80ad30b0f99ef..1bf71b13cbb0f 100644 --- a/clang/include/clang/Sema/SemaOpenMP.h +++ b/clang/include/clang/Sema/SemaOpenMP.h @@ -1196,21 +1196,21 @@ class SemaOpenMP : public SemaBase { SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, - ArrayRef UnresolvedReductions = std::nullopt); + ArrayRef UnresolvedReductions = {}); /// Called on well-formed 'task_reduction' clause. OMPClause *ActOnOpenMPTaskReductionClause( ArrayRef VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, - ArrayRef UnresolvedReductions = std::nullopt); + ArrayRef UnresolvedReductions = {}); /// Called on well-formed 'in_reduction' clause. OMPClause *ActOnOpenMPInReductionClause( ArrayRef VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, - ArrayRef UnresolvedReductions = std::nullopt); + ArrayRef UnresolvedReductions = {}); /// Called on well-formed 'linear' clause. OMPClause *ActOnOpenMPLinearClause( ArrayRef VarList, Expr *Step, SourceLocation StartLoc, @@ -1263,7 +1263,7 @@ class SemaOpenMP : public SemaBase { OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef VarList, const OMPVarListLocTy &Locs, bool NoDiagnose = false, - ArrayRef UnresolvedMappers = std::nullopt); + ArrayRef UnresolvedMappers = {}); /// Called on well-formed 'num_teams' clause. OMPClause *ActOnOpenMPNumTeamsClause(ArrayRef VarList, SourceLocation StartLoc, @@ -1295,7 +1295,7 @@ class SemaOpenMP : public SemaBase { CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef VarList, const OMPVarListLocTy &Locs, - ArrayRef UnresolvedMappers = std::nullopt); + ArrayRef UnresolvedMappers = {}); /// Called on well-formed 'from' clause. OMPClause * ActOnOpenMPFromClause(ArrayRef MotionModifiers, @@ -1303,7 +1303,7 @@ class SemaOpenMP : public SemaBase { CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef VarList, const OMPVarListLocTy &Locs, - ArrayRef UnresolvedMappers = std::nullopt); + ArrayRef UnresolvedMappers = {}); /// Called on well-formed 'use_device_ptr' clause. OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef VarList, const OMPVarListLocTy &Locs); diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index ead96ce6891c3..8974342166fad 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -644,14 +644,14 @@ class BugReporter { void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, - ArrayRef Ranges = std::nullopt, - ArrayRef Fixits = std::nullopt); + ArrayRef Ranges = {}, + ArrayRef Fixits = {}); void EmitBasicReport(const Decl *DeclWithIssue, CheckerNameRef CheckerName, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, - ArrayRef Ranges = std::nullopt, - ArrayRef Fixits = std::nullopt); + ArrayRef Ranges = {}, + ArrayRef Fixits = {}); private: llvm::StringMap> StrBugTypes; diff --git a/clang/lib/ARCMigrate/Internals.h b/clang/lib/ARCMigrate/Internals.h index d790c7c02189b..de6ebdce1bea1 100644 --- a/clang/lib/ARCMigrate/Internals.h +++ b/clang/lib/ARCMigrate/Internals.h @@ -74,7 +74,7 @@ class TransformActions { bool clearDiagnostic(ArrayRef IDs, SourceRange range); bool clearAllDiagnostics(SourceRange range) { - return clearDiagnostic(std::nullopt, range); + return clearDiagnostic({}, range); } bool clearDiagnostic(unsigned ID1, unsigned ID2, SourceRange range) { unsigned IDs[] = { ID1, ID2 }; diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4bf8ddd762e9a..869e51159aec1 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1052,7 +1052,7 @@ ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) { auto MergedIt = MergedDefModules.find(cast(Def->getCanonicalDecl())); if (MergedIt == MergedDefModules.end()) - return std::nullopt; + return {}; return MergedIt->second; } @@ -1111,7 +1111,7 @@ void ASTContext::addLazyModuleInitializers(Module *M, ArrayRef ASTContext::getModuleInitializers(Module *M) { auto It = ModuleInitializers.find(M); if (It == ModuleInitializers.end()) - return std::nullopt; + return {}; auto *Inits = It->second; Inits->resolve(*this); diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index cce8b12170f21..d022c5c845ae6 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -210,7 +210,7 @@ void DeclInfo::fill() { IsInstanceMethod = false; IsClassMethod = false; IsVariadic = false; - ParamVars = std::nullopt; + ParamVars = {}; TemplateParameters = nullptr; if (!CommentDecl) { diff --git a/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp index d5e5bb27ceba3..61508fe886efc 100644 --- a/clang/lib/AST/CommentParser.cpp +++ b/clang/lib/AST/CommentParser.cpp @@ -499,7 +499,7 @@ BlockCommandComment *Parser::parseBlockCommand() { if (isTokBlockCommand()) { // Block command ahead. We can't nest block commands, so pretend that this // command has an empty argument. - ParagraphComment *Paragraph = S.actOnParagraphComment(std::nullopt); + ParagraphComment *Paragraph = S.actOnParagraphComment({}); if (PC) { S.actOnParamCommandFinish(PC, Paragraph); return PC; @@ -547,7 +547,7 @@ BlockCommandComment *Parser::parseBlockCommand() { ParagraphComment *Paragraph; if (EmptyParagraph) - Paragraph = S.actOnParagraphComment(std::nullopt); + Paragraph = S.actOnParagraphComment({}); else { BlockContentComment *Block = parseParagraphOrBlockCommand(); // Since we have checked for a block command, we should have parsed a diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 8321cee0e0bc9..86913763ef9ff 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -5506,9 +5506,8 @@ IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { - return new (C, ID) - IndirectFieldDecl(C, nullptr, SourceLocation(), DeclarationName(), - QualType(), std::nullopt); + return new (C, ID) IndirectFieldDecl(C, nullptr, SourceLocation(), + DeclarationName(), QualType(), {}); } SourceRange EnumConstantDecl::getSourceRange() const { @@ -5748,7 +5747,7 @@ ImportDecl *ImportDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, ArrayRef ImportDecl::getIdentifierLocs() const { if (!isImportComplete()) - return std::nullopt; + return {}; const auto *StoredLocs = getTrailingObjects(); return llvm::ArrayRef(StoredLocs, diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 34bb200e43360..eedd1bc022570 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -3292,8 +3292,7 @@ UsingPackDecl *UsingPackDecl::Create(ASTContext &C, DeclContext *DC, UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumExpansions) { size_t Extra = additionalSizeToAlloc(NumExpansions); - auto *Result = - new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, std::nullopt); + auto *Result = new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, {}); Result->NumExpansions = NumExpansions; auto *Trail = Result->getTrailingObjects(); for (unsigned I = 0; I != NumExpansions; ++I) @@ -3442,7 +3441,7 @@ DecompositionDecl *DecompositionDecl::CreateDeserialized(ASTContext &C, size_t Extra = additionalSizeToAlloc(NumBindings); auto *Result = new (C, ID, Extra) DecompositionDecl(C, nullptr, SourceLocation(), SourceLocation(), - QualType(), nullptr, StorageClass(), std::nullopt); + QualType(), nullptr, StorageClass(), {}); // Set up and clean out the bindings array. Result->NumBindings = NumBindings; auto *Trail = Result->getTrailingObjects(); diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 83062b0e68878..ae8a310769260 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -947,12 +947,12 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C, assert((!SelLocs.empty() || isImplicit()) && "No selector locs for non-implicit method"); if (isImplicit()) - return setParamsAndSelLocs(C, Params, std::nullopt); + return setParamsAndSelLocs(C, Params, {}); setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params, DeclEndLoc)); if (getSelLocsKind() != SelLoc_NonStandard) - return setParamsAndSelLocs(C, Params, std::nullopt); + return setParamsAndSelLocs(C, Params, {}); setParamsAndSelLocs(C, Params, SelLocs); } diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp index 81ca48e60942d..32c82f614d6f2 100644 --- a/clang/lib/AST/DeclOpenMP.cpp +++ b/clang/lib/AST/DeclOpenMP.cpp @@ -30,7 +30,7 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C, SourceLocation L, ArrayRef VL) { auto *D = OMPDeclarativeDirective::createDirective( - C, DC, std::nullopt, VL.size(), L); + C, DC, {}, VL.size(), L); D->setVars(VL); return D; } diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index d2d8907b884ec..4a506b7be4564 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -794,8 +794,7 @@ NonTypeTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, additionalSizeToAlloc, Expr *>( NumExpandedTypes, HasTypeConstraint ? 1 : 0)) NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(), - 0, 0, nullptr, QualType(), nullptr, - std::nullopt, std::nullopt); + 0, 0, nullptr, QualType(), nullptr, {}, {}); NTTP->NumExpandedTypes = NumExpandedTypes; return NTTP; } @@ -870,7 +869,7 @@ TemplateTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, auto *TTP = new (C, ID, additionalSizeToAlloc(NumExpansions)) TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr, - false, nullptr, std::nullopt); + false, nullptr, {}); TTP->NumExpandedParams = NumExpansions; return TTP; } diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 66db6263cb1bd..bf2c1b92fa6b4 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -4720,8 +4720,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C, OK_Ordinary) { BaseAndUpdaterExprs[0] = baseExpr; - InitListExpr *ILE = - new (C) InitListExpr(C, lBraceLoc, std::nullopt, rBraceLoc); + InitListExpr *ILE = new (C) InitListExpr(C, lBraceLoc, {}, rBraceLoc); ILE->setType(baseExpr->getType()); BaseAndUpdaterExprs[1] = ILE; diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 3931fcaa35296..dbc161347025c 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -397,7 +397,7 @@ class MicrosoftCXXNameMangler { void mangleBits(llvm::APInt Number); void mangleTagTypeKind(TagTypeKind TK); void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName, - ArrayRef NestedNames = std::nullopt); + ArrayRef NestedNames = {}); void mangleAddressSpaceType(QualType T, Qualifiers Quals, SourceRange Range); void mangleType(QualType T, SourceRange Range, QualifierMangleMode QMM = QMM_Mangle); diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp index 5adfd91957460..4f441c2f92dc7 100644 --- a/clang/lib/AST/StmtOpenMP.cpp +++ b/clang/lib/AST/StmtOpenMP.cpp @@ -452,8 +452,7 @@ OMPReverseDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits) { OMPReverseDirective *Dir = createDirective( - C, std::nullopt, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, - EndLoc); + C, {}, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc); Dir->setTransformedStmt(TransformedStmt); Dir->setPreInits(PreInits); return Dir; @@ -555,7 +554,7 @@ OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C, Stmt *AssociatedStmt, bool HasCancel) { auto *Dir = - createDirective(C, std::nullopt, AssociatedStmt, + createDirective(C, {}, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); Dir->setHasCancel(HasCancel); return Dir; @@ -605,7 +604,7 @@ OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt) { - return createDirective(C, std::nullopt, AssociatedStmt, + return createDirective(C, {}, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); } diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp index 127e843d4ead2..c5f35b35ad357 100644 --- a/clang/lib/Analysis/BodyFarm.cpp +++ b/clang/lib/Analysis/BodyFarm.cpp @@ -542,7 +542,7 @@ static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) { CallExpr *CE = CallExpr::Create( /*ASTContext=*/C, /*StmtClass=*/M.makeLvalueToRvalue(/*Expr=*/Block), - /*Args=*/std::nullopt, + /*Args=*/{}, /*QualType=*/C.VoidTy, /*ExprValueType=*/VK_PRValue, /*SourceLocation=*/SourceLocation(), FPOptionsOverride()); @@ -610,7 +610,7 @@ static Stmt *create_dispatch_sync(ASTContext &C, const FunctionDecl *D) { ASTMaker M(C); DeclRefExpr *DR = M.makeDeclRefExpr(PV); ImplicitCastExpr *ICE = M.makeLvalueToRvalue(DR, Ty); - CallExpr *CE = CallExpr::Create(C, ICE, std::nullopt, C.VoidTy, VK_PRValue, + CallExpr *CE = CallExpr::Create(C, ICE, {}, C.VoidTy, VK_PRValue, SourceLocation(), FPOptionsOverride()); return CE; } diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp index 5e0ec9ecc92ea..fad2f52e89ef1 100644 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -3605,7 +3605,7 @@ class VariableGroupsManagerImpl : public VariableGroupsManager { auto It = VarGrpMap.find(Var); if (It == VarGrpMap.end()) - return std::nullopt; + return {}; return Groups[It->second]; } diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h index 94d9ba93ed226..6edd3474d4eda 100644 --- a/clang/lib/Basic/Targets/AMDGPU.h +++ b/clang/lib/Basic/Targets/AMDGPU.h @@ -122,7 +122,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo { ArrayRef getGCCRegNames() const override; ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } /// Accepted register names: (n, m is unsigned integer, n < m) diff --git a/clang/lib/Basic/Targets/ARC.h b/clang/lib/Basic/Targets/ARC.h index fcbfdd6eec586..7f3d0aa15ab81 100644 --- a/clang/lib/Basic/Targets/ARC.h +++ b/clang/lib/Basic/Targets/ARC.h @@ -40,9 +40,7 @@ class LLVM_LIBRARY_VISIBILITY ARCTargetInfo : public TargetInfo { void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; @@ -60,7 +58,7 @@ class LLVM_LIBRARY_VISIBILITY ARCTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/lib/Basic/Targets/AVR.h b/clang/lib/Basic/Targets/AVR.h index 0a2f51747f8a7..df1f8d171efba 100644 --- a/clang/lib/Basic/Targets/AVR.h +++ b/clang/lib/Basic/Targets/AVR.h @@ -63,9 +63,7 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo { void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } bool allowsLargerPreferedTypeAlignment() const override { return false; } @@ -84,7 +82,7 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } ArrayRef getGCCAddlRegNames() const override { diff --git a/clang/lib/Basic/Targets/BPF.h b/clang/lib/Basic/Targets/BPF.h index d19b37dd4df7a..27a4b5f314970 100644 --- a/clang/lib/Basic/Targets/BPF.h +++ b/clang/lib/Basic/Targets/BPF.h @@ -67,9 +67,7 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo { } bool isValidGCCRegisterName(StringRef Name) const override { return true; } - ArrayRef getGCCRegNames() const override { - return std::nullopt; - } + ArrayRef getGCCRegNames() const override { return {}; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override { @@ -86,7 +84,7 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } bool allowDebugInfoForExternalRef() const override { return true; } diff --git a/clang/lib/Basic/Targets/DirectX.h b/clang/lib/Basic/Targets/DirectX.h index 19b61252409b0..ab22d1281a4df 100644 --- a/clang/lib/Basic/Targets/DirectX.h +++ b/clang/lib/Basic/Targets/DirectX.h @@ -72,15 +72,11 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo { return Feature == "directx"; } - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } std::string_view getClobbers() const override { return ""; } - ArrayRef getGCCRegNames() const override { - return std::nullopt; - } + ArrayRef getGCCRegNames() const override { return {}; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override { @@ -88,7 +84,7 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } BuiltinVaListKind getBuiltinVaListKind() const override { diff --git a/clang/lib/Basic/Targets/Lanai.h b/clang/lib/Basic/Targets/Lanai.h index 144cbc7de9893..f7e439c7c9e1c 100644 --- a/clang/lib/Basic/Targets/Lanai.h +++ b/clang/lib/Basic/Targets/Lanai.h @@ -78,9 +78,7 @@ class LLVM_LIBRARY_VISIBILITY LanaiTargetInfo : public TargetInfo { return TargetInfo::VoidPtrBuiltinVaList; } - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override { diff --git a/clang/lib/Basic/Targets/M68k.cpp b/clang/lib/Basic/Targets/M68k.cpp index 8b8bf97d6f99a..b5b29fd867563 100644 --- a/clang/lib/Basic/Targets/M68k.cpp +++ b/clang/lib/Basic/Targets/M68k.cpp @@ -117,7 +117,7 @@ void M68kTargetInfo::getTargetDefines(const LangOptions &Opts, ArrayRef M68kTargetInfo::getTargetBuiltins() const { // FIXME: Implement. - return std::nullopt; + return {}; } bool M68kTargetInfo::hasFeature(StringRef Feature) const { diff --git a/clang/lib/Basic/Targets/MSP430.h b/clang/lib/Basic/Targets/MSP430.h index 25639b8c1e0ad..2266ada25c1dd 100644 --- a/clang/lib/Basic/Targets/MSP430.h +++ b/clang/lib/Basic/Targets/MSP430.h @@ -52,7 +52,7 @@ class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo { ArrayRef getTargetBuiltins() const override { // FIXME: Implement. - return std::nullopt; + return {}; } bool allowsLargerPreferedTypeAlignment() const override { return false; } diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h index 1ef20ce733917..165b28a60fb2a 100644 --- a/clang/lib/Basic/Targets/NVPTX.h +++ b/clang/lib/Basic/Targets/NVPTX.h @@ -93,7 +93,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo { ArrayRef getGCCRegAliases() const override { // No aliases. - return std::nullopt; + return {}; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/lib/Basic/Targets/PNaCl.cpp b/clang/lib/Basic/Targets/PNaCl.cpp index 51b6452b0c203..c4adfbefb9c73 100644 --- a/clang/lib/Basic/Targets/PNaCl.cpp +++ b/clang/lib/Basic/Targets/PNaCl.cpp @@ -16,12 +16,10 @@ using namespace clang; using namespace clang::targets; -ArrayRef PNaClTargetInfo::getGCCRegNames() const { - return std::nullopt; -} +ArrayRef PNaClTargetInfo::getGCCRegNames() const { return {}; } ArrayRef PNaClTargetInfo::getGCCRegAliases() const { - return std::nullopt; + return {}; } void PNaClTargetInfo::getArchDefines(const LangOptions &Opts, diff --git a/clang/lib/Basic/Targets/PNaCl.h b/clang/lib/Basic/Targets/PNaCl.h index 595c4d83b1d1c..7e0e10aa362d8 100644 --- a/clang/lib/Basic/Targets/PNaCl.h +++ b/clang/lib/Basic/Targets/PNaCl.h @@ -52,9 +52,7 @@ class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo { return Feature == "pnacl"; } - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::PNaClABIBuiltinVaList; diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h index cc79562de2871..30c7ac8d9c037 100644 --- a/clang/lib/Basic/Targets/SPIR.h +++ b/clang/lib/Basic/Targets/SPIR.h @@ -159,15 +159,11 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo { // memcpy as per section 3 of the SPIR spec. bool useFP16ConversionIntrinsics() const override { return false; } - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } std::string_view getClobbers() const override { return ""; } - ArrayRef getGCCRegNames() const override { - return std::nullopt; - } + ArrayRef getGCCRegNames() const override { return {}; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override { @@ -175,7 +171,7 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } BuiltinVaListKind getBuiltinVaListKind() const override { diff --git a/clang/lib/Basic/Targets/Sparc.h b/clang/lib/Basic/Targets/Sparc.h index ee0d3e2b4329e..9c529a5bc5e7f 100644 --- a/clang/lib/Basic/Targets/Sparc.h +++ b/clang/lib/Basic/Targets/Sparc.h @@ -50,7 +50,7 @@ class LLVM_LIBRARY_VISIBILITY SparcTargetInfo : public TargetInfo { ArrayRef getTargetBuiltins() const override { // FIXME: Implement! - return std::nullopt; + return {}; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; diff --git a/clang/lib/Basic/Targets/SystemZ.h b/clang/lib/Basic/Targets/SystemZ.h index f05ea473017be..ef9a07033a6e4 100644 --- a/clang/lib/Basic/Targets/SystemZ.h +++ b/clang/lib/Basic/Targets/SystemZ.h @@ -105,7 +105,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo { ArrayRef getGCCRegAliases() const override { // No aliases. - return std::nullopt; + return {}; } ArrayRef getGCCAddlRegNames() const override; diff --git a/clang/lib/Basic/Targets/TCE.h b/clang/lib/Basic/Targets/TCE.h index dcf684fe6dbc0..d6280b02f07b2 100644 --- a/clang/lib/Basic/Targets/TCE.h +++ b/clang/lib/Basic/Targets/TCE.h @@ -95,9 +95,7 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo { bool hasFeature(StringRef Feature) const override { return Feature == "tce"; } - ArrayRef getTargetBuiltins() const override { - return std::nullopt; - } + ArrayRef getTargetBuiltins() const override { return {}; } std::string_view getClobbers() const override { return ""; } @@ -105,9 +103,7 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo { return TargetInfo::VoidPtrBuiltinVaList; } - ArrayRef getGCCRegNames() const override { - return std::nullopt; - } + ArrayRef getGCCRegNames() const override { return {}; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override { @@ -115,7 +111,7 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } }; diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h index 213ec42ca84bb..8dd371c320200 100644 --- a/clang/lib/Basic/Targets/WebAssembly.h +++ b/clang/lib/Basic/Targets/WebAssembly.h @@ -123,10 +123,10 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo { return VoidPtrBuiltinVaList; } - ArrayRef getGCCRegNames() const final { return std::nullopt; } + ArrayRef getGCCRegNames() const final { return {}; } ArrayRef getGCCRegAliases() const final { - return std::nullopt; + return {}; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index a99ae62984c7d..2affb659a160b 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -210,7 +210,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { ArrayRef getGCCRegNames() const override; ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } ArrayRef getGCCAddlRegNames() const override; diff --git a/clang/lib/Basic/Targets/XCore.h b/clang/lib/Basic/Targets/XCore.h index a58d3e8acf479..84fd59d1a71e4 100644 --- a/clang/lib/Basic/Targets/XCore.h +++ b/clang/lib/Basic/Targets/XCore.h @@ -60,7 +60,7 @@ class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo : public TargetInfo { } ArrayRef getGCCRegAliases() const override { - return std::nullopt; + return {}; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 1ad950798c211..7715bd34fe499 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -2024,7 +2024,7 @@ Value *CodeGenFunction::EmitCheckedArgForBuiltin(const Expr *E, SanitizerHandler::InvalidBuiltin, {EmitCheckSourceLocation(E->getExprLoc()), llvm::ConstantInt::get(Builder.getInt8Ty(), Kind)}, - std::nullopt); + {}); return ArgValue; } @@ -18523,9 +18523,9 @@ Value *EmitAMDGPUWorkGroupSize(CodeGenFunction &CGF, unsigned Index) { APInt(16, CGF.getTarget().getMaxOpenCLWorkGroupSize() + 1)); LD->setMetadata(llvm::LLVMContext::MD_range, RNode); LD->setMetadata(llvm::LLVMContext::MD_noundef, - llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); + llvm::MDNode::get(CGF.getLLVMContext(), {})); LD->setMetadata(llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); + llvm::MDNode::get(CGF.getLLVMContext(), {})); return LD; } @@ -18539,7 +18539,7 @@ Value *EmitAMDGPUGridSize(CodeGenFunction &CGF, unsigned Index) { auto *LD = CGF.Builder.CreateLoad( Address(GEP, CGF.Int32Ty, CharUnits::fromQuantity(4))); LD->setMetadata(llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); + llvm::MDNode::get(CGF.getLLVMContext(), {})); return LD; } } // namespace diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 4ae981e4013e9..5f50ab6f34ff8 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -118,8 +118,8 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual FTNP) { // When translating an unprototyped function type, always use a // variadic type. return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(), - FnInfoOpts::None, std::nullopt, - FTNP->getExtInfo(), {}, RequiredArgs(0)); + FnInfoOpts::None, {}, FTNP->getExtInfo(), {}, + RequiredArgs(0)); } static void addExtParameterInfosForCall( @@ -473,7 +473,7 @@ CodeGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) { // non-variadic type. if (CanQual noProto = FTy.getAs()) { return arrangeLLVMFunctionInfo(noProto->getReturnType(), FnInfoOpts::None, - std::nullopt, noProto->getExtInfo(), {}, + {}, noProto->getExtInfo(), {}, RequiredArgs::All); } @@ -719,8 +719,8 @@ CodeGenTypes::arrangeCXXMethodCall(const CallArgList &args, } const CGFunctionInfo &CodeGenTypes::arrangeNullaryFunction() { - return arrangeLLVMFunctionInfo(getContext().VoidTy, FnInfoOpts::None, - std::nullopt, FunctionType::ExtInfo(), {}, + return arrangeLLVMFunctionInfo(getContext().VoidTy, FnInfoOpts::None, {}, + FunctionType::ExtInfo(), {}, RequiredArgs::All); } @@ -4423,7 +4423,7 @@ void CodeGenFunction::EmitNonNullArgCheck(RValue RV, QualType ArgType, EmitCheckSourceLocation(ArgLoc), EmitCheckSourceLocation(AttrLoc), llvm::ConstantInt::get(Int32Ty, ArgNo + 1), }; - EmitCheck(std::make_pair(Cond, CheckKind), Handler, StaticData, std::nullopt); + EmitCheck(std::make_pair(Cond, CheckKind), Handler, StaticData, {}); } void CodeGenFunction::EmitNonNullArgCheck(Address Addr, QualType ArgType, @@ -4814,7 +4814,7 @@ CodeGenFunction::EmitNounwindRuntimeCall(llvm::FunctionCallee callee, /// runtime function. llvm::CallInst *CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee callee, const llvm::Twine &name) { - return EmitRuntimeCall(callee, std::nullopt, name); + return EmitRuntimeCall(callee, {}, name); } // Calls which may throw must have operand bundles indicating which funclet @@ -4881,7 +4881,7 @@ void CodeGenFunction::EmitNoreturnRuntimeCallOrInvoke( llvm::CallBase * CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, const Twine &name) { - return EmitRuntimeCallOrInvoke(callee, std::nullopt, name); + return EmitRuntimeCallOrInvoke(callee, {}, name); } /// Emits a call or invoke instruction to the given runtime function. diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 5d253c92a38a8..d9c0dbe45d6cf 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -1329,8 +1329,7 @@ static void EmitSehScope(CodeGenFunction &CGF, CGF.getBundlesForFunclet(SehCppScope.getCallee()); if (CGF.CurrentFuncletPad) BundleList.emplace_back("funclet", CGF.CurrentFuncletPad); - CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, std::nullopt, - BundleList); + CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, {}, BundleList); CGF.EmitBlock(Cont); } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 06015a9e541ea..27bbbfc6f531a 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2642,7 +2642,7 @@ void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI, return; llvm::MDNode *node; if (AllocatedTy->isVoidType()) - node = llvm::MDNode::get(CGM.getLLVMContext(), std::nullopt); + node = llvm::MDNode::get(CGM.getLLVMContext(), {}); else node = getOrCreateType(AllocatedTy, getOrCreateFile(Loc)); @@ -4324,8 +4324,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, !CGM.getCodeGenOpts().EmitCodeView)) // Create fake but valid subroutine type. Otherwise -verify would fail, and // subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields. - return DBuilder.createSubroutineType( - DBuilder.getOrCreateTypeArray(std::nullopt)); + return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray({})); if (const auto *Method = dyn_cast(D)) return getOrCreateMethodType(Method, F); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 1e8ffb53b53a0..e0ea65bcaf363 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2042,7 +2042,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile, if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) { Load->setMetadata(llvm::LLVMContext::MD_range, RangeInfo); Load->setMetadata(llvm::LLVMContext::MD_noundef, - llvm::MDNode::get(getLLVMContext(), std::nullopt)); + llvm::MDNode::get(getLLVMContext(), {})); } return EmitFromMemory(Load, Ty); @@ -3375,9 +3375,9 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) { // Format the type name as if for a diagnostic, including quotes and // optionally an 'aka'. SmallString<32> Buffer; - CGM.getDiags().ConvertArgToString( - DiagnosticsEngine::ak_qualtype, (intptr_t)T.getAsOpaquePtr(), StringRef(), - StringRef(), std::nullopt, Buffer, std::nullopt); + CGM.getDiags().ConvertArgToString(DiagnosticsEngine::ak_qualtype, + (intptr_t)T.getAsOpaquePtr(), StringRef(), + StringRef(), {}, Buffer, {}); if (IsBitInt) { // The Structure is: 0 to end the string, 32 bit unsigned integer in target @@ -3884,7 +3884,7 @@ void CodeGenFunction::EmitUnreachable(SourceLocation Loc) { EmitCheck(std::make_pair(static_cast(Builder.getFalse()), SanitizerKind::Unreachable), SanitizerHandler::BuiltinUnreachable, - EmitCheckSourceLocation(Loc), std::nullopt); + EmitCheckSourceLocation(Loc), {}); } Builder.CreateUnreachable(); } diff --git a/clang/lib/CodeGen/CGLoopInfo.cpp b/clang/lib/CodeGen/CGLoopInfo.cpp index 6b886bd6b6d2c..cdff7e50c4ee7 100644 --- a/clang/lib/CodeGen/CGLoopInfo.cpp +++ b/clang/lib/CodeGen/CGLoopInfo.cpp @@ -506,7 +506,7 @@ LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs, Attrs.CodeAlign == 0 && !StartLoc && !EndLoc && !Attrs.MustProgress) return; - TempLoopID = MDNode::getTemporary(Header->getContext(), std::nullopt); + TempLoopID = MDNode::getTemporary(Header->getContext(), {}); } void LoopInfo::finish() { diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index a73a71f2d2688..28da353ff2d78 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -140,7 +140,7 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc()); cast(Ptr)->setMetadata( llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(getLLVMContext(), std::nullopt)); + llvm::MDNode::get(getLLVMContext(), {})); return Builder.CreateBitCast(Ptr, ConvertType(E->getType())); } @@ -2319,7 +2319,7 @@ llvm::Value *CodeGenFunction::EmitARCRetainBlock(llvm::Value *value, CGM.getObjCEntrypoints().objc_retainBlock); call->setMetadata("clang.arc.copy_on_escape", - llvm::MDNode::get(Builder.getContext(), std::nullopt)); + llvm::MDNode::get(Builder.getContext(), {})); } return result; @@ -2361,8 +2361,7 @@ static void emitAutoreleasedReturnValueMarker(CodeGenFunction &CGF) { // Call the marker asm if we made one, which we do only at -O0. if (marker) - CGF.Builder.CreateCall(marker, std::nullopt, - CGF.getBundlesForFunclet(marker)); + CGF.Builder.CreateCall(marker, {}, CGF.getBundlesForFunclet(marker)); } static llvm::Value *emitOptimizedARCReturnCall(llvm::Value *value, @@ -2449,7 +2448,7 @@ void CodeGenFunction::EmitARCRelease(llvm::Value *value, if (precise == ARCImpreciseLifetime) { call->setMetadata("clang.imprecise_release", - llvm::MDNode::get(Builder.getContext(), std::nullopt)); + llvm::MDNode::get(Builder.getContext(), {})); } } @@ -2843,7 +2842,7 @@ void CodeGenFunction::EmitObjCRelease(llvm::Value *value, if (precise == ARCImpreciseLifetime) { call->setMetadata("clang.imprecise_release", - llvm::MDNode::get(Builder.getContext(), std::nullopt)); + llvm::MDNode::get(Builder.getContext(), {})); } } diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 6280e9465ecba..7a07284f8a8aa 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -69,7 +69,7 @@ class LazyRuntimeFunction { FTy = llvm::FunctionType::get(RetTy, ArgTys, false); } else { - FTy = llvm::FunctionType::get(RetTy, std::nullopt, false); + FTy = llvm::FunctionType::get(RetTy, {}, false); } } diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 30f3911a8b03c..1c16d273a5535 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -7191,7 +7191,7 @@ CGObjCNonFragileABIMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF, if (IsIvarOffsetKnownIdempotent(CGF, Ivar)) cast(IvarOffsetValue) ->setMetadata(llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(VMContext, std::nullopt)); + llvm::MDNode::get(VMContext, {})); } // This could be 32bit int or 64bit integer depending on the architecture. @@ -7589,7 +7589,7 @@ llvm::Value *CGObjCNonFragileABIMac::EmitSelector(CodeGenFunction &CGF, llvm::LoadInst* LI = CGF.Builder.CreateLoad(Addr); LI->setMetadata(llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(VMContext, std::nullopt)); + llvm::MDNode::get(VMContext, {})); return LI; } diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3747b00d4893a..fa22baaed2a91 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -5075,7 +5075,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc, }; RegionCodeGenTy RCG(CodeGen); CommonActionTy Action( - nullptr, std::nullopt, + nullptr, {}, OMPBuilder.getOrCreateRuntimeFunction( CGM.getModule(), WithNowait ? OMPRTL___kmpc_end_reduce_nowait : OMPRTL___kmpc_end_reduce), @@ -5197,7 +5197,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc, ThreadId, // i32 Lock // kmp_critical_name *& }; - CommonActionTy Action(nullptr, std::nullopt, + CommonActionTy Action(nullptr, {}, OMPBuilder.getOrCreateRuntimeFunction( CGM.getModule(), OMPRTL___kmpc_end_reduce), EndArgs); @@ -6819,7 +6819,7 @@ class MappableExprsHandler { const ValueDecl *Mapper = nullptr, bool ForDeviceAddr = false, const ValueDecl *BaseDecl = nullptr, const Expr *MapExpr = nullptr, ArrayRef - OverlappedElements = std::nullopt, + OverlappedElements = {}, bool AreBothBasePtrAndPteeMapped = false) const { // The following summarizes what has to be generated for each map and the // types below. The generated information is expressed in this order: @@ -7693,7 +7693,7 @@ class MappableExprsHandler { // for map(to: lambda): using user specified map type. return getMapTypeBits( I->getSecond()->getMapType(), I->getSecond()->getMapTypeModifiers(), - /*MotionModifiers=*/std::nullopt, I->getSecond()->isImplicit(), + /*MotionModifiers=*/{}, I->getSecond()->isImplicit(), /*AddPtrFlag=*/false, /*AddIsTargetParamFlag=*/false, /*isNonContiguous=*/false); @@ -7818,7 +7818,7 @@ class MappableExprsHandler { for (const auto L : C->component_lists()) { const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr; InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(), - C->getMapTypeModifiers(), std::nullopt, + C->getMapTypeModifiers(), {}, /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L), E); ++EI; @@ -7834,7 +7834,7 @@ class MappableExprsHandler { Kind = Present; const auto *EI = C->getVarRefs().begin(); for (const auto L : C->component_lists()) { - InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_to, std::nullopt, + InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_to, {}, C->getMotionModifiers(), /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L), *EI); ++EI; @@ -7850,8 +7850,8 @@ class MappableExprsHandler { Kind = Present; const auto *EI = C->getVarRefs().begin(); for (const auto L : C->component_lists()) { - InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, - std::nullopt, C->getMotionModifiers(), + InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, {}, + C->getMotionModifiers(), /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L), *EI); ++EI; @@ -7903,9 +7903,9 @@ class MappableExprsHandler { // processed. Nonetheless, generateInfoForComponentList must be // called to take the pointer into account for the calculation of // the range of the partial struct. - InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, std::nullopt, - std::nullopt, /*ReturnDevicePointer=*/false, IsImplicit, - nullptr, nullptr, IsDevAddr); + InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, {}, {}, + /*ReturnDevicePointer=*/false, IsImplicit, nullptr, nullptr, + IsDevAddr); DeferredInfo[nullptr].emplace_back(IE, VD, IsDevAddr); } else { llvm::Value *Ptr; @@ -8056,7 +8056,7 @@ class MappableExprsHandler { CurInfo, StructBaseCurInfo, PartialStruct, /*IsFirstComponentList=*/false, L.IsImplicit, /*GenerateAllInfoForClauses*/ true, L.Mapper, L.ForDeviceAddr, VD, - L.VarRef, /*OverlappedElements*/ std::nullopt, + L.VarRef, /*OverlappedElements*/ {}, HasMapBasePtr && HasMapArraySec); // If this entry relates to a device pointer, set the relevant @@ -8692,7 +8692,7 @@ class MappableExprsHandler { ArrayRef OverlappedComponents = Pair.getSecond(); generateInfoForComponentList( - MapType, MapModifiers, std::nullopt, Components, CombinedInfo, + MapType, MapModifiers, {}, Components, CombinedInfo, StructBaseCombinedInfo, PartialStruct, IsFirstComponentList, IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper, /*ForDeviceAddr=*/false, VD, VarRef, OverlappedComponents); @@ -8711,12 +8711,11 @@ class MappableExprsHandler { auto It = OverlappedData.find(&L); if (It == OverlappedData.end()) generateInfoForComponentList( - MapType, MapModifiers, std::nullopt, Components, CombinedInfo, + MapType, MapModifiers, {}, Components, CombinedInfo, StructBaseCombinedInfo, PartialStruct, IsFirstComponentList, IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper, /*ForDeviceAddr=*/false, VD, VarRef, - /*OverlappedElements*/ std::nullopt, - HasMapBasePtr && HasMapArraySec); + /*OverlappedElements*/ {}, HasMapBasePtr && HasMapArraySec); IsFirstComponentList = false; } } diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h index f65314d014c08..5e7715743afb5 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -352,7 +352,7 @@ class CGOpenMPRuntime { /// Emits \p Callee function call with arguments \p Args with location \p Loc. void emitCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee Callee, - ArrayRef Args = std::nullopt) const; + ArrayRef Args = {}) const; /// Emits address of the word in a memory where current thread id is /// stored. @@ -1543,7 +1543,7 @@ class CGOpenMPRuntime { virtual void emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, - ArrayRef Args = std::nullopt) const; + ArrayRef Args = {}) const; /// Emits OpenMP-specific function prolog. /// Required for device constructs. diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index 35ff75416cb77..72992b489a332 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -985,8 +985,8 @@ llvm::Function *CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction( getDistributeLastprivateVars(CGM.getContext(), D, LastPrivatesReductions); if (!LastPrivatesReductions.empty()) { GlobalizedRD = ::buildRecordForGlobalizedVars( - CGM.getContext(), std::nullopt, LastPrivatesReductions, - MappedDeclsFields, WarpSize); + CGM.getContext(), {}, LastPrivatesReductions, MappedDeclsFields, + WarpSize); } } else if (!LastPrivatesReductions.empty()) { assert(!TeamAndReductions.first && @@ -1681,7 +1681,7 @@ void CGOpenMPRuntimeGPU::emitReduction( ++Cnt; } const RecordDecl *ReductionRec = ::buildRecordForGlobalizedVars( - CGM.getContext(), PrivatesReductions, std::nullopt, VarFieldMap, 1); + CGM.getContext(), PrivatesReductions, {}, VarFieldMap, 1); if (TeamsReduction) TeamsReductions.push_back(ReductionRec); @@ -2344,11 +2344,11 @@ llvm::Value *CGOpenMPRuntimeGPU::getGPUNumThreads(CodeGenFunction &CGF) { const char *LocSize = "__kmpc_get_hardware_num_threads_in_block"; llvm::Function *F = M->getFunction(LocSize); if (!F) { - F = llvm::Function::Create( - llvm::FunctionType::get(CGF.Int32Ty, std::nullopt, false), - llvm::GlobalVariable::ExternalLinkage, LocSize, &CGF.CGM.getModule()); + F = llvm::Function::Create(llvm::FunctionType::get(CGF.Int32Ty, {}, false), + llvm::GlobalVariable::ExternalLinkage, LocSize, + &CGF.CGM.getModule()); } - return Bld.CreateCall(F, std::nullopt, "nvptx_num_threads"); + return Bld.CreateCall(F, {}, "nvptx_num_threads"); } llvm::Value *CGOpenMPRuntimeGPU::getGPUThreadID(CodeGenFunction &CGF) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h index 4d586ec972f8d..b59f43a6915dd 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h @@ -294,9 +294,10 @@ class CGOpenMPRuntimeGPU : public CGOpenMPRuntime { /// Emits call of the outlined function with the provided arguments, /// translating these arguments to correct target-specific arguments. - void emitOutlinedFunctionCall( - CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, - ArrayRef Args = std::nullopt) const override; + void + emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc, + llvm::FunctionCallee OutlinedFn, + ArrayRef Args = {}) const override; /// Emits OpenMP-specific function prolog. /// Required for device constructs. diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 71a27d0c6bc1f..0da7855ab05c6 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -501,7 +501,7 @@ static llvm::Function *emitOutlinedFunctionPrologue( FunctionDecl *DebugFunctionDecl = nullptr; if (!FO.UIntPtrCastRequired) { FunctionProtoType::ExtProtoInfo EPI; - QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, std::nullopt, EPI); + QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, {}, EPI); DebugFunctionDecl = FunctionDecl::Create( Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(), SourceLocation(), DeclarationName(), FunctionTy, @@ -5509,7 +5509,7 @@ void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) { if (const auto *FlushClause = S.getSingleClause()) return llvm::ArrayRef(FlushClause->varlist_begin(), FlushClause->varlist_end()); - return std::nullopt; + return {}; }(), S.getBeginLoc(), AO); } @@ -6199,7 +6199,7 @@ static void emitOMPAtomicReadExpr(CodeGenFunction &CGF, llvm::AtomicOrdering AO, case llvm::AtomicOrdering::Acquire: case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::SequentiallyConsistent: - CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, + CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc, llvm::AtomicOrdering::Acquire); break; case llvm::AtomicOrdering::Monotonic: @@ -6228,7 +6228,7 @@ static void emitOMPAtomicWriteExpr(CodeGenFunction &CGF, case llvm::AtomicOrdering::Release: case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::SequentiallyConsistent: - CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, + CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc, llvm::AtomicOrdering::Release); break; case llvm::AtomicOrdering::Acquire: @@ -6418,7 +6418,7 @@ static void emitOMPAtomicUpdateExpr(CodeGenFunction &CGF, case llvm::AtomicOrdering::Release: case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::SequentiallyConsistent: - CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, + CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc, llvm::AtomicOrdering::Release); break; case llvm::AtomicOrdering::Acquire: @@ -6533,17 +6533,17 @@ static void emitOMPAtomicCaptureExpr(CodeGenFunction &CGF, // operation is also an acquire flush. switch (AO) { case llvm::AtomicOrdering::Release: - CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, + CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc, llvm::AtomicOrdering::Release); break; case llvm::AtomicOrdering::Acquire: - CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, + CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc, llvm::AtomicOrdering::Acquire); break; case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::SequentiallyConsistent: CGF.CGM.getOpenMPRuntime().emitFlush( - CGF, std::nullopt, Loc, llvm::AtomicOrdering::AcquireRelease); + CGF, {}, Loc, llvm::AtomicOrdering::AcquireRelease); break; case llvm::AtomicOrdering::Monotonic: break; diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 465dc8c661af5..573ced0857d5f 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1595,7 +1595,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, llvm::Value *IsFalse = Builder.getFalse(); EmitCheck(std::make_pair(IsFalse, SanitizerKind::Return), SanitizerHandler::MissingReturn, - EmitCheckSourceLocation(FD->getLocation()), std::nullopt); + EmitCheckSourceLocation(FD->getLocation()), {}); } else if (ShouldEmitUnreachable) { if (CGM.getCodeGenOpts().OptimizationLevel == 0) EmitTrapCall(llvm::Intrinsic::trap); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 5f203fe0b128b..750a6cc24badc 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3524,7 +3524,7 @@ class CodeGenFunction : public CodeGenTypeCache { /// This function may clear the current insertion point; callers should use /// EnsureInsertPoint if they wish to subsequently generate code without first /// calling EmitBlock, EmitBranch, or EmitStmt. - void EmitStmt(const Stmt *S, ArrayRef Attrs = std::nullopt); + void EmitStmt(const Stmt *S, ArrayRef Attrs = {}); /// EmitSimpleStmt - Try to emit a "simple" statement which does not /// necessarily require an insertion point or debug information; typically @@ -3551,11 +3551,9 @@ class CodeGenFunction : public CodeGenTypeCache { void EmitIndirectGotoStmt(const IndirectGotoStmt &S); void EmitIfStmt(const IfStmt &S); - void EmitWhileStmt(const WhileStmt &S, - ArrayRef Attrs = std::nullopt); - void EmitDoStmt(const DoStmt &S, ArrayRef Attrs = std::nullopt); - void EmitForStmt(const ForStmt &S, - ArrayRef Attrs = std::nullopt); + void EmitWhileStmt(const WhileStmt &S, ArrayRef Attrs = {}); + void EmitDoStmt(const DoStmt &S, ArrayRef Attrs = {}); + void EmitForStmt(const ForStmt &S, ArrayRef Attrs = {}); void EmitReturnStmt(const ReturnStmt &S); void EmitDeclStmt(const DeclStmt &S); void EmitBreakStmt(const BreakStmt &S); @@ -3632,7 +3630,7 @@ class CodeGenFunction : public CodeGenTypeCache { llvm::Value *ParentFP); void EmitCXXForRangeStmt(const CXXForRangeStmt &S, - ArrayRef Attrs = std::nullopt); + ArrayRef Attrs = {}); /// Controls insertion of cancellation exit blocks in worksharing constructs. class OMPCancelStackRAII { diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 1b77490e261c2..8d5787769382f 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -753,8 +753,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::MDNode *getNoObjCARCExceptionsMetadata() { if (!NoObjCARCExceptionsMetadata) - NoObjCARCExceptionsMetadata = - llvm::MDNode::get(getLLVMContext(), std::nullopt); + NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), {}); return NoObjCARCExceptionsMetadata; } @@ -1181,8 +1180,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID); - llvm::Function *getIntrinsic(unsigned IID, - ArrayRef Tys = std::nullopt); + llvm::Function *getIntrinsic(unsigned IID, ArrayRef Tys = {}); /// Emit code for a single top level declaration. void EmitTopLevelDecl(Decl *D); diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 0a63c50d44f4b..45518736a2ac3 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -649,7 +649,7 @@ struct EmptyCoverageMappingBuilder : public CoverageMappingBuilder { if (MappingRegions.empty()) return; - CoverageMappingWriter Writer(FileIDMapping, std::nullopt, MappingRegions); + CoverageMappingWriter Writer(FileIDMapping, {}, MappingRegions); Writer.write(OS); } }; diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 89f9457523824..9b3c2f1b2af67 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -1416,7 +1416,7 @@ void ItaniumCXXABI::emitRethrow(CodeGenFunction &CGF, bool isNoReturn) { llvm::FunctionCallee Fn = CGM.CreateRuntimeFunction(FTy, "__cxa_rethrow"); if (isNoReturn) - CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, std::nullopt); + CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, {}); else CGF.EmitRuntimeCallOrInvoke(Fn); } diff --git a/clang/lib/Frontend/DiagnosticRenderer.cpp b/clang/lib/Frontend/DiagnosticRenderer.cpp index 017ce1c17d5c9..8b32af1337257 100644 --- a/clang/lib/Frontend/DiagnosticRenderer.cpp +++ b/clang/lib/Frontend/DiagnosticRenderer.cpp @@ -146,7 +146,7 @@ void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) { void DiagnosticRenderer::emitBasicNote(StringRef Message) { emitDiagnosticMessage(FullSourceLoc(), PresumedLoc(), DiagnosticsEngine::Note, - Message, std::nullopt, DiagOrStoredDiag()); + Message, {}, DiagOrStoredDiag()); } /// Prints an include stack when appropriate for a particular @@ -451,7 +451,7 @@ void DiagnosticRenderer::emitSingleMacroExpansion( Message << "expanded from macro '" << MacroName << "'"; emitDiagnostic(SpellingLoc, DiagnosticsEngine::Note, Message.str(), - SpellingRanges, std::nullopt); + SpellingRanges, {}); } /// Check that the macro argument location of Loc starts with ArgumentLoc. diff --git a/clang/lib/Index/IndexingContext.h b/clang/lib/Index/IndexingContext.h index 89363b529fe99..3020b33bea385 100644 --- a/clang/lib/Index/IndexingContext.h +++ b/clang/lib/Index/IndexingContext.h @@ -68,17 +68,17 @@ class IndexingContext { static bool isTemplateImplicitInstantiation(const Decl *D); bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(), - ArrayRef Relations = std::nullopt); + ArrayRef Relations = {}); bool handleDecl(const Decl *D, SourceLocation Loc, SymbolRoleSet Roles = SymbolRoleSet(), - ArrayRef Relations = std::nullopt, + ArrayRef Relations = {}, const DeclContext *DC = nullptr); bool handleReference(const NamedDecl *D, SourceLocation Loc, const NamedDecl *Parent, const DeclContext *DC, SymbolRoleSet Roles = SymbolRoleSet(), - ArrayRef Relations = std::nullopt, + ArrayRef Relations = {}, const Expr *RefE = nullptr); void handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc, @@ -94,8 +94,7 @@ class IndexingContext { bool indexDecl(const Decl *D); - void indexTagDecl(const TagDecl *D, - ArrayRef Relations = std::nullopt); + void indexTagDecl(const TagDecl *D, ArrayRef Relations = {}); void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent, const DeclContext *DC = nullptr, diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 2aada51c71c50..d0a4bb366a14a 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -712,7 +712,7 @@ ModuleMap::findAllModulesForHeader(FileEntryRef File) { if (findOrCreateModuleForHeaderInUmbrellaDir(File)) return Headers.find(File)->second; - return std::nullopt; + return {}; } ArrayRef @@ -721,7 +721,7 @@ ModuleMap::findResolvedModulesForHeader(FileEntryRef File) const { resolveHeaderDirectives(File); auto It = Headers.find(File); if (It == Headers.end()) - return std::nullopt; + return {}; return It->second; } diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index d48bb8a9a9cde..3eef3dc9b0f34 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -286,8 +286,8 @@ void Preprocessor::dumpMacroInfo(const IdentifierInfo *II) { // Dump module macros. llvm::DenseSet Active; - for (auto *MM : - State ? State->getActiveModuleMacros(*this, II) : std::nullopt) + for (auto *MM : State ? State->getActiveModuleMacros(*this, II) + : ArrayRef()) Active.insert(MM); llvm::DenseSet Visited; llvm::SmallVector Worklist(Leaf); diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 122a05be1c039..31984453487ae 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2445,8 +2445,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // Recover as if it were an explicit specialization. TemplateParameterLists FakedParamLists; FakedParamLists.push_back(Actions.ActOnTemplateParameterList( - 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, - std::nullopt, LAngleLoc, nullptr)); + 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {}, + LAngleLoc, nullptr)); TheDecl = ParseFunctionDefinition( D, @@ -2787,8 +2787,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes( // Recover as if it were an explicit specialization. TemplateParameterLists FakedParamLists; FakedParamLists.push_back(Actions.ActOnTemplateParameterList( - 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, - std::nullopt, LAngleLoc, nullptr)); + 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {}, + LAngleLoc, nullptr)); ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D); diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc1..a3c1cf0e94f15 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2220,8 +2220,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, - std::nullopt, LAngleLoc, nullptr)); + 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {}, + LAngleLoc, nullptr)); TemplateParams = &FakedParamLists; } } diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 2fb4be0035b66..4570a18bc0d5e 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -3855,8 +3855,8 @@ ExprResult Parser::ParseBlockLiteralExpression() { /*NumExceptions=*/0, /*NoexceptExpr=*/nullptr, /*ExceptionSpecTokens=*/nullptr, - /*DeclsInPrototype=*/std::nullopt, - CaretLoc, CaretLoc, ParamInfo), + /*DeclsInPrototype=*/{}, CaretLoc, + CaretLoc, ParamInfo), CaretLoc); MaybeParseGNUAttributes(ParamInfo); diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index e96cddf88a134..ce3624f366a2a 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -1579,9 +1579,8 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer( DynamicExceptionRanges.data(), DynamicExceptions.size(), NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr, /*ExceptionSpecTokens*/ nullptr, - /*DeclsInPrototype=*/std::nullopt, LParenLoc, - FunLocalRangeEnd, D, TrailingReturnType, - TrailingReturnTypeLoc, &DS), + /*DeclsInPrototype=*/{}, LParenLoc, FunLocalRangeEnd, D, + TrailingReturnType, TrailingReturnTypeLoc, &DS), std::move(Attributes), DeclEndLoc); // We have called ActOnLambdaClosureQualifiers for parentheses-less cases diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp index dd59cb23236d7..07f133408c387 100644 --- a/clang/lib/Parse/ParseInit.cpp +++ b/clang/lib/Parse/ParseInit.cpp @@ -487,7 +487,7 @@ ExprResult Parser::ParseBraceInitializer() { : diag::ext_c_empty_initializer); } // Match the '}'. - return Actions.ActOnInitList(LBraceLoc, std::nullopt, ConsumeBrace()); + return Actions.ActOnInitList(LBraceLoc, {}, ConsumeBrace()); } // Enter an appropriate expression evaluation context for an initializer list. diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index dad39d8dc736d..28ccd3061f843 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -3227,13 +3227,13 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, cutOffParsing(); if (SuperLoc.isValid()) Actions.CodeCompletion().CodeCompleteObjCSuperMessage( - getCurScope(), SuperLoc, std::nullopt, false); + getCurScope(), SuperLoc, {}, false); else if (ReceiverType) Actions.CodeCompletion().CodeCompleteObjCClassMessage( - getCurScope(), ReceiverType, std::nullopt, false); + getCurScope(), ReceiverType, {}, false); else Actions.CodeCompletion().CodeCompleteObjCInstanceMessage( - getCurScope(), ReceiverExpr, std::nullopt, false); + getCurScope(), ReceiverExpr, {}, false); return ExprError(); } diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 108b532be4168..16f731174fd0e 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -2561,7 +2561,7 @@ StmtResult Parser::ParseOpenMPExecutableDirective( DKind == OMPD_target_exit_data) { Actions.OpenMP().ActOnOpenMPRegionStart(DKind, getCurScope()); AssociatedStmt = (Sema::CompoundScopeRAII(Actions), - Actions.ActOnCompoundStmt(Loc, Loc, std::nullopt, + Actions.ActOnCompoundStmt(Loc, Loc, {}, /*isStmtExpr=*/false)); AssociatedStmt = Actions.OpenMP().ActOnOpenMPRegionEnd(AssociatedStmt, Clauses); diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 60d647da48f05..7d727efb22873 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -2558,8 +2558,7 @@ 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, std::nullopt, false); + FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false); } BodyScope.Exit(); @@ -2596,8 +2595,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) { // compound statement as the body. if (FnBody.isInvalid()) { Sema::CompoundScopeRAII CompoundScope(Actions); - FnBody = - Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false); + FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false); } BodyScope.Exit(); diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 5e9886a109468..2b51765e80864 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -2536,8 +2536,8 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, // with default arguments, etc. if (IsMemExpr && !E.isTypeDependent()) { Sema::TentativeAnalysisScope Trap(*this); - ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(), - std::nullopt, SourceLocation()); + ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(), {}, + SourceLocation()); if (R.isUsable()) { ZeroArgCallReturnTy = R.get()->getType(); return true; @@ -2689,7 +2689,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, // FIXME: Try this before emitting the fixit, and suppress diagnostics // while doing so. - E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), std::nullopt, + E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), {}, Range.getEnd().getLocWithOffset(1)); return true; } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 2bcb930acdcb5..27b274d74ce71 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6300,7 +6300,7 @@ class CheckFormatHandler : public analyze_format_string::FormatStringHandler { EmitFormatDiagnostic(Sema &S, bool inFunctionCall, const Expr *ArgumentExpr, const PartialDiagnostic &PDiag, SourceLocation StringLoc, bool IsStringLocation, Range StringRange, - ArrayRef Fixit = std::nullopt); + ArrayRef Fixit = {}); protected: bool HandleInvalidConversionSpecifier(unsigned argIndex, SourceLocation Loc, @@ -6327,7 +6327,7 @@ class CheckFormatHandler : public analyze_format_string::FormatStringHandler { template void EmitFormatDiagnostic(PartialDiagnostic PDiag, SourceLocation StringLoc, bool IsStringLocation, Range StringRange, - ArrayRef Fixit = std::nullopt); + ArrayRef Fixit = {}); }; } // namespace diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 3e31f3d82657a..16a76ff9b5c24 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -4567,8 +4567,7 @@ void SemaCodeCompletion::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, 0) { ParsedType T = DS.getRepAsType(); if (!T.get().isNull() && T.get()->isObjCObjectOrInterfaceType()) - AddClassMessageCompletions(SemaRef, S, T, std::nullopt, false, false, - Results); + AddClassMessageCompletions(SemaRef, S, T, {}, false, false, Results); } // Note that we intentionally suppress macro results here, since we do not @@ -4931,7 +4930,7 @@ void SemaCodeCompletion::CodeCompletePostfixExpression(Scope *S, ExprResult E, if (E.isInvalid()) CodeCompleteExpression(S, PreferredType); else if (getLangOpts().ObjC) - CodeCompleteObjCInstanceMessage(S, E.get(), std::nullopt, false); + CodeCompleteObjCInstanceMessage(S, E.get(), {}, false); } /// The set of properties that have already been added, referenced by @@ -7747,8 +7746,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertyGetter(Scope *S) { Results.EnterNewScope(); VisitedSelectorSet Selectors; - AddObjCMethods(Class, true, MK_ZeroArgSelector, std::nullopt, - SemaRef.CurContext, Selectors, + AddObjCMethods(Class, true, MK_ZeroArgSelector, {}, SemaRef.CurContext, + Selectors, /*AllowSameLength=*/true, Results); Results.ExitScope(); HandleCodeCompleteResults(&SemaRef, CodeCompleter, @@ -7776,8 +7775,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySetter(Scope *S) { Results.EnterNewScope(); VisitedSelectorSet Selectors; - AddObjCMethods(Class, true, MK_OneArgSelector, std::nullopt, - SemaRef.CurContext, Selectors, + AddObjCMethods(Class, true, MK_OneArgSelector, {}, SemaRef.CurContext, + Selectors, /*AllowSameLength=*/true, Results); Results.ExitScope(); @@ -8075,8 +8074,7 @@ void SemaCodeCompletion::CodeCompleteObjCMessageReceiver(Scope *S) { if (Iface->getSuperClass()) { Results.AddResult(Result("super")); - AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, std::nullopt, - Results); + AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, {}, Results); } if (getLangOpts().CPlusPlus11) diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index 89a0beadc61f3..3724aaf804c90 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -341,7 +341,7 @@ static Expr *maybeTailCall(Sema &S, QualType RetType, Expr *E, // EvaluateBinaryTypeTrait(BTT_IsConvertible, ...) which is at the moment // a private function in SemaExprCXX.cpp - ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", std::nullopt); + ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", {}); if (AddressExpr.isInvalid()) return nullptr; @@ -392,8 +392,8 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise, return Result.get(); }; - CallExpr *AwaitReady = cast_or_null( - BuildSubExpr(ACT::ACT_Ready, "await_ready", std::nullopt)); + CallExpr *AwaitReady = + cast_or_null(BuildSubExpr(ACT::ACT_Ready, "await_ready", {})); if (!AwaitReady) return Calls; if (!AwaitReady->getType()->isDependentType()) { @@ -454,7 +454,7 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise, } } - BuildSubExpr(ACT::ACT_Resume, "await_resume", std::nullopt); + BuildSubExpr(ACT::ACT_Resume, "await_resume", {}); // Make sure the awaiter object gets a chance to be cleaned up. S.Cleanup.setExprNeedsCleanups(true); @@ -722,8 +722,8 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc, SourceLocation Loc = Fn->getLocation(); // Build the initial suspend point auto buildSuspends = [&](StringRef Name) mutable -> StmtResult { - ExprResult Operand = buildPromiseCall(*this, ScopeInfo->CoroutinePromise, - Loc, Name, std::nullopt); + ExprResult Operand = + buildPromiseCall(*this, ScopeInfo->CoroutinePromise, Loc, Name, {}); if (Operand.isInvalid()) return StmtError(); ExprResult Suspend = @@ -1049,7 +1049,7 @@ StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E, PC = buildPromiseCall(*this, Promise, Loc, "return_value", E); } else { E = MakeFullDiscardedValueExpr(E).get(); - PC = buildPromiseCall(*this, Promise, Loc, "return_void", std::nullopt); + PC = buildPromiseCall(*this, Promise, Loc, "return_void", {}); } if (PC.isInvalid()) return StmtError(); @@ -1735,8 +1735,8 @@ bool CoroutineStmtBuilder::makeOnException() { if (!S.getLangOpts().CXXExceptions) return true; - ExprResult UnhandledException = buildPromiseCall( - S, Fn.CoroutinePromise, Loc, "unhandled_exception", std::nullopt); + ExprResult UnhandledException = + buildPromiseCall(S, Fn.CoroutinePromise, Loc, "unhandled_exception", {}); UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc, /*DiscardedValue*/ false); if (UnhandledException.isInvalid()) @@ -1759,8 +1759,8 @@ bool CoroutineStmtBuilder::makeReturnObject() { // [dcl.fct.def.coroutine]p7 // The expression promise.get_return_object() is used to initialize the // returned reference or prvalue result object of a call to a coroutine. - ExprResult ReturnObject = buildPromiseCall(S, Fn.CoroutinePromise, Loc, - "get_return_object", std::nullopt); + ExprResult ReturnObject = + buildPromiseCall(S, Fn.CoroutinePromise, Loc, "get_return_object", {}); if (ReturnObject.isInvalid()) return false; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 229c9080d558e..25061f02c13f6 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -14135,8 +14135,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { InitializationKind Kind = InitializationKind::CreateDefault(Var->getLocation()); - InitializationSequence InitSeq(*this, Entity, Kind, std::nullopt); - ExprResult Init = InitSeq.Perform(*this, Entity, Kind, std::nullopt); + InitializationSequence InitSeq(*this, Entity, Kind, {}); + ExprResult Init = InitSeq.Perform(*this, Entity, Kind, {}); if (Init.get()) { Var->setInit(MaybeCreateExprWithCleanups(Init.get())); @@ -16428,8 +16428,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, /*NumExceptions=*/0, /*NoexceptExpr=*/nullptr, /*ExceptionSpecTokens=*/nullptr, - /*DeclsInPrototype=*/std::nullopt, - Loc, Loc, D), + /*DeclsInPrototype=*/{}, Loc, Loc, + D), std::move(DS.getAttributes()), SourceLocation()); D.SetIdentifier(&II, Loc); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 43ec25b23d972..1a691c0e1689d 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1281,7 +1281,7 @@ static bool checkTupleLikeDecomposition(Sema &S, if (E.isInvalid()) return true; - E = S.BuildCallExpr(nullptr, E.get(), Loc, std::nullopt, Loc); + E = S.BuildCallExpr(nullptr, E.get(), Loc, {}, Loc); } else { // Otherwise, the initializer is get(e), where get is looked up // in the associated namespaces. @@ -4797,8 +4797,8 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, case IIK_Default: { InitializationKind InitKind = InitializationKind::CreateDefault(Constructor->getLocation()); - InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, std::nullopt); - BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt); + InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {}); + BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {}); break; } @@ -4962,9 +4962,8 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, InitializationKind InitKind = InitializationKind::CreateDefault(Loc); - InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, std::nullopt); - ExprResult MemberInit = - InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt); + InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {}); + ExprResult MemberInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {}); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); if (MemberInit.isInvalid()) @@ -10992,7 +10991,7 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R, EPI.Variadic = false; EPI.TypeQuals = Qualifiers(); EPI.RefQualifier = RQ_None; - return Context.getFunctionType(Context.VoidTy, std::nullopt, EPI); + return Context.getFunctionType(Context.VoidTy, {}, EPI); } static void extendLeft(SourceRange &R, SourceRange Before) { @@ -11172,8 +11171,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, // of the errors above fired) and with the conversion type as the // return type. if (D.isInvalidType()) - R = Context.getFunctionType(ConvType, std::nullopt, - Proto->getExtProtoInfo()); + R = Context.getFunctionType(ConvType, {}, Proto->getExtProtoInfo()); // C++0x explicit conversion operators. if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus20) @@ -13867,7 +13865,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( DefaultCon->setAccess(AS_public); DefaultCon->setDefaulted(); - setupImplicitSpecialMemberType(DefaultCon, Context.VoidTy, std::nullopt); + setupImplicitSpecialMemberType(DefaultCon, Context.VoidTy, {}); if (getLangOpts().CUDA) CUDA().inferTargetForImplicitSpecialMember( @@ -14153,7 +14151,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) { Destructor->setAccess(AS_public); Destructor->setDefaulted(); - setupImplicitSpecialMemberType(Destructor, Context.VoidTy, std::nullopt); + setupImplicitSpecialMemberType(Destructor, Context.VoidTy, {}); if (getLangOpts().CUDA) CUDA().inferTargetForImplicitSpecialMember( @@ -14312,8 +14310,7 @@ void Sema::AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor) { FunctionProtoType::ExtProtoInfo EPI = DtorType->getExtProtoInfo(); EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.SourceDecl = Destructor; - Destructor->setType( - Context.getFunctionType(Context.VoidTy, std::nullopt, EPI)); + Destructor->setType(Context.getFunctionType(Context.VoidTy, {}, EPI)); // FIXME: If the destructor has a body that could throw, and the newly created // spec doesn't allow exceptions, we should emit a warning, because this @@ -15639,8 +15636,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, : CopyConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); CopyConstructor->setBody( - ActOnCompoundStmt(Loc, Loc, std::nullopt, /*isStmtExpr=*/false) - .getAs()); + ActOnCompoundStmt(Loc, Loc, {}, /*isStmtExpr=*/false).getAs()); CopyConstructor->markUsed(Context); } @@ -15771,8 +15767,7 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation, : MoveConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); MoveConstructor->setBody( - ActOnCompoundStmt(Loc, Loc, std::nullopt, /*isStmtExpr=*/false) - .getAs()); + ActOnCompoundStmt(Loc, Loc, {}, /*isStmtExpr=*/false).getAs()); MoveConstructor->markUsed(Context); } @@ -17228,8 +17223,7 @@ bool Sema::EvaluateStaticAssertMessageAsString(Expr *Message, CXXScopeSpec(), SourceLocation(), nullptr, LR, nullptr, nullptr); if (Res.isInvalid()) return ExprError(); - Res = BuildCallExpr(nullptr, Res.get(), Loc, std::nullopt, Loc, nullptr, - false, true); + Res = BuildCallExpr(nullptr, Res.get(), Loc, {}, Loc, nullptr, false, true); if (Res.isInvalid()) return ExprError(); if (Res.get()->isTypeDependent() || Res.get()->isValueDependent()) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index d8cd09b827293..78acfeddb7863 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -5511,10 +5511,9 @@ void SemaObjC::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { InitializationKind InitKind = InitializationKind::CreateDefault(ObjCImplementation->getLocation()); - InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, - std::nullopt); + InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {}); ExprResult MemberInit = - InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt); + InitSeq.Perform(SemaRef, InitEntity, InitKind, {}); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); // Note, MemberInit could actually come back empty if no initialization // is required (e.g., because it would call a trivial default constructor) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 6807f44562f6c..ff6616901016a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1079,8 +1079,8 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, if (TrapFn.isInvalid()) return ExprError(); - ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), - std::nullopt, E->getEndLoc()); + ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), {}, + E->getEndLoc()); if (Call.isInvalid()) return ExprError(); @@ -2164,8 +2164,8 @@ Sema::ActOnStringLiteral(ArrayRef StringToks, Scope *UDLScope) { TemplateArgument Arg(Lit); TemplateArgumentLocInfo ArgInfo(Lit); ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); - return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, - StringTokLocs.back(), &ExplicitArgs); + return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(), + &ExplicitArgs); } case LOLR_StringTemplatePack: { @@ -2185,8 +2185,8 @@ Sema::ActOnStringLiteral(ArrayRef StringToks, Scope *UDLScope) { TemplateArgumentLocInfo ArgInfo; ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); } - return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, - StringTokLocs.back(), &ExplicitArgs); + return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(), + &ExplicitArgs); } case LOLR_Raw: case LOLR_ErrorNoDiagnostic: @@ -2801,7 +2801,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS, // a template name, but we happen to have always already looked up the name // before we get here if it must be a template name. if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr, - std::nullopt, nullptr, &TE)) { + {}, nullptr, &TE)) { if (TE && KeywordReplacement) { auto &State = getTypoExprState(TE); auto BestTC = State.Consumer->getNextCorrection(); @@ -3787,8 +3787,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { TemplateArgumentLocInfo ArgInfo; ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); } - return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, TokLoc, - &ExplicitArgs); + return BuildLiteralOperatorCall(R, OpNameInfo, {}, TokLoc, &ExplicitArgs); } case LOLR_StringTemplatePack: llvm_unreachable("unexpected literal operator lookup result"); @@ -16245,7 +16244,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, if (isa(FTy)) { FunctionProtoType::ExtProtoInfo EPI; EPI.ExtInfo = Ext; - BlockTy = Context.getFunctionType(RetTy, std::nullopt, EPI); + BlockTy = Context.getFunctionType(RetTy, {}, EPI); // Otherwise, if we don't need to change anything about the function type, // preserve its sugar structure. @@ -16266,7 +16265,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, } else { FunctionProtoType::ExtProtoInfo EPI; EPI.ExtInfo = FunctionType::ExtInfo().withNoReturn(NoReturn); - BlockTy = Context.getFunctionType(RetTy, std::nullopt, EPI); + BlockTy = Context.getFunctionType(RetTy, {}, EPI); } DiagnoseUnusedParameters(BD->parameters()); @@ -20144,7 +20143,8 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef Stmts, bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD) { return DiagRuntimeBehavior( - Loc, Statement ? llvm::ArrayRef(Statement) : std::nullopt, PD); + Loc, Statement ? llvm::ArrayRef(Statement) : llvm::ArrayRef(), + PD); } bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc, diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 2f914ddc22a38..35fbc4e7c30eb 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -305,7 +305,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(SemaObjC &S, SourceLocation Loc, ParmVarDecl::Create(S.SemaRef.Context, Method, SourceLocation(), SourceLocation(), &CX.Idents.get("value"), NumberType, /*TInfo=*/nullptr, SC_None, nullptr); - Method->setMethodParams(S.SemaRef.Context, value, std::nullopt); + Method->setMethodParams(S.SemaRef.Context, value, {}); } if (!validateBoxingMethod(S.SemaRef, Loc, S.NSNumberDecl, Sel, Method)) @@ -588,7 +588,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { Context.getPointerType(ConstCharType), /*TInfo=*/nullptr, SC_None, nullptr); - M->setMethodParams(Context, value, std::nullopt); + M->setMethodParams(Context, value, {}); BoxingMethod = M; } @@ -713,7 +713,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { SC_None, nullptr); Params.push_back(type); - M->setMethodParams(Context, Params, std::nullopt); + M->setMethodParams(Context, Params, {}); BoxingMethod = M; } @@ -843,7 +843,7 @@ ExprResult SemaObjC::BuildObjCArrayLiteral(SourceRange SR, /*TInfo=*/nullptr, SC_None, nullptr); Params.push_back(cnt); - Method->setMethodParams(Context, Params, std::nullopt); + Method->setMethodParams(Context, Params, {}); } if (!validateBoxingMethod(SemaRef, Loc, NSArrayDecl, Sel, Method)) @@ -1012,7 +1012,7 @@ ExprResult SemaObjC::BuildObjCDictionaryLiteral( /*TInfo=*/nullptr, SC_None, nullptr); Params.push_back(cnt); - Method->setMethodParams(Context, Params, std::nullopt); + Method->setMethodParams(Context, Params, {}); } if (!validateBoxingMethod(SemaRef, SR.getBegin(), NSDictionaryDecl, Sel, @@ -4388,7 +4388,7 @@ bool SemaObjC::CheckObjCBridgeRelatedConversions(SourceLocation Loc, ExprResult msg = BuildInstanceMessageImplicit( SrcExpr, SrcType, InstanceMethod->getLocation(), - InstanceMethod->getSelector(), InstanceMethod, std::nullopt); + InstanceMethod->getSelector(), InstanceMethod, {}); SrcExpr = msg.get(); } return true; diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index f560865681fa5..573e90aced3ee 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -569,7 +569,7 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc, true); MultiExprArg SubInit; Expr *InitExpr; - InitListExpr DummyInitList(SemaRef.Context, Loc, std::nullopt, Loc); + InitListExpr DummyInitList(SemaRef.Context, Loc, {}, Loc); // C++ [dcl.init.aggr]p7: // If there are fewer initializer-clauses in the list than there are @@ -588,10 +588,9 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc, // // Only do this if we're initializing a class type, to avoid filling in // the initializer list where possible. - InitExpr = VerifyOnly - ? &DummyInitList - : new (SemaRef.Context) - InitListExpr(SemaRef.Context, Loc, std::nullopt, Loc); + InitExpr = VerifyOnly ? &DummyInitList + : new (SemaRef.Context) + InitListExpr(SemaRef.Context, Loc, {}, Loc); InitExpr->setType(SemaRef.Context.VoidTy); SubInit = InitExpr; Kind = InitializationKind::CreateCopy(Loc, Loc); @@ -3403,7 +3402,7 @@ InitListChecker::createInitListExpr(QualType CurrentObjectType, SourceRange InitRange, unsigned ExpectedNumInits) { InitListExpr *Result = new (SemaRef.Context) InitListExpr( - SemaRef.Context, InitRange.getBegin(), std::nullopt, InitRange.getEnd()); + SemaRef.Context, InitRange.getBegin(), {}, InitRange.getEnd()); QualType ResultType = CurrentObjectType; if (!ResultType->isArrayType()) @@ -5650,7 +5649,7 @@ static void TryDefaultInitialization(Sema &S, // constructor for T is called (and the initialization is ill-formed if // T has no accessible default constructor); if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) { - TryConstructorInitialization(S, Entity, Kind, std::nullopt, DestType, + TryConstructorInitialization(S, Entity, Kind, {}, DestType, Entity.getType(), Sequence); return; } @@ -5687,11 +5686,13 @@ static void TryOrBuildParenListInitialization( const InitializationKind &SubKind, Expr *Arg, Expr **InitExpr = nullptr) { InitializationSequence IS = InitializationSequence( - S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt); + S, SubEntity, SubKind, + Arg ? MultiExprArg(Arg) : MutableArrayRef()); if (IS.Failed()) { if (!VerifyOnly) { - IS.Diagnose(S, SubEntity, SubKind, Arg ? ArrayRef(Arg) : std::nullopt); + IS.Diagnose(S, SubEntity, SubKind, + Arg ? ArrayRef(Arg) : ArrayRef()); } else { Sequence.SetFailed( InitializationSequence::FK_ParenthesizedListInitFailed); @@ -5702,7 +5703,7 @@ static void TryOrBuildParenListInitialization( if (!VerifyOnly) { ExprResult ER; ER = IS.Perform(S, SubEntity, SubKind, - Arg ? MultiExprArg(Arg) : std::nullopt); + Arg ? MultiExprArg(Arg) : MutableArrayRef()); if (ER.isInvalid()) return false; diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 7b9d5f4ff7eb3..e7afa0f4c81fc 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -909,8 +909,8 @@ getDummyLambdaType(Sema &S, SourceLocation Loc = SourceLocation()) { QualType DefaultTypeForNoTrailingReturn = S.getLangOpts().CPlusPlus14 ? S.Context.getAutoDeductType() : S.Context.DependentTy; - QualType MethodTy = S.Context.getFunctionType(DefaultTypeForNoTrailingReturn, - std::nullopt, EPI); + QualType MethodTy = + S.Context.getFunctionType(DefaultTypeForNoTrailingReturn, {}, EPI); return S.Context.getTrivialTypeSourceInfo(MethodTy, Loc); } @@ -1681,8 +1681,7 @@ static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange, ConvExtInfo.TypeQuals = Qualifiers(); ConvExtInfo.TypeQuals.addConst(); ConvExtInfo.ExceptionSpec.Type = EST_BasicNoexcept; - QualType ConvTy = - S.Context.getFunctionType(PtrToFunctionTy, std::nullopt, ConvExtInfo); + QualType ConvTy = S.Context.getFunctionType(PtrToFunctionTy, {}, ConvExtInfo); SourceLocation Loc = IntroducerRange.getBegin(); DeclarationName ConversionName @@ -1864,8 +1863,7 @@ static void addBlockPointerConversion(Sema &S, /*IsVariadic=*/false, /*IsCXXMethod=*/true)); ConversionEPI.TypeQuals = Qualifiers(); ConversionEPI.TypeQuals.addConst(); - QualType ConvTy = - S.Context.getFunctionType(BlockPtrTy, std::nullopt, ConversionEPI); + QualType ConvTy = S.Context.getFunctionType(BlockPtrTy, {}, ConversionEPI); SourceLocation Loc = IntroducerRange.getBegin(); DeclarationName Name diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index e5db11369221a..8468e9a730c2d 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -1200,7 +1200,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) { EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_C); EPI.ExceptionSpec = EST_None; QualType ExpectedType = R.getSema().Context.getFunctionType( - R.getLookupName().getCXXNameType(), std::nullopt, EPI); + R.getLookupName().getCXXNameType(), {}, EPI); // Perform template argument deduction against the type that we would // expect the function to have. diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 031f2a6af8774..5c4dc93ff16cd 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -2552,7 +2552,7 @@ void SemaObjC::ProcessPropertyDecl(ObjCPropertyDecl *property) { /*TInfo=*/nullptr, SC_None, nullptr); - SetterMethod->setMethodParams(Context, Argument, std::nullopt); + SetterMethod->setMethodParams(Context, Argument, {}); AddPropertyAttrs(SemaRef, SetterMethod, property); diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp index d33b0d0c1c301..aadcd7183e713 100644 --- a/clang/lib/Sema/SemaOpenACC.cpp +++ b/clang/lib/Sema/SemaOpenACC.cpp @@ -1986,8 +1986,7 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, // Fill in a dummy 'length' so that when we instantiate this we don't // double-diagnose here. ExprResult Recovery = SemaRef.CreateRecoveryExpr( - ColonLoc, SourceLocation(), ArrayRef{std::nullopt}, - Context.IntTy); + ColonLoc, SourceLocation(), ArrayRef(), Context.IntTy); Length = Recovery.isUsable() ? Recovery.get() : nullptr; } diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index fa81fc42c0ee5..79e1536288e60 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -15901,9 +15901,9 @@ OMPClause *SemaOpenMP::ActOnOpenMPSimpleClause( return Res; } -static std::string -getListOfPossibleValues(OpenMPClauseKind K, unsigned First, unsigned Last, - ArrayRef Exclude = std::nullopt) { +static std::string getListOfPossibleValues(OpenMPClauseKind K, unsigned First, + unsigned Last, + ArrayRef Exclude = {}) { SmallString<256> Buffer; llvm::raw_svector_ostream Out(Buffer); unsigned Skipped = Exclude.size(); @@ -21296,7 +21296,7 @@ static void checkMappableExpressionList( CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo MapperId, ArrayRef UnresolvedMappers, OpenMPMapClauseKind MapType = OMPC_MAP_unknown, - ArrayRef Modifiers = std::nullopt, + ArrayRef Modifiers = {}, bool IsMapTypeImplicit = false, bool NoDiagnose = false) { // We only expect mappable expressions in 'to', 'from', and 'map' clauses. assert((CKind == OMPC_map || CKind == OMPC_to || CKind == OMPC_from) && diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 7b86299561a36..4aeceba128b29 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -5502,7 +5502,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType, } if (CT->getSize().ugt(e)) { // Need an init from empty {}, is there one? - InitListExpr EmptyList(S.Context, From->getEndLoc(), std::nullopt, + InitListExpr EmptyList(S.Context, From->getEndLoc(), {}, From->getEndLoc()); EmptyList.setType(S.Context.VoidTy); DfltElt = TryListConversion( @@ -7479,7 +7479,7 @@ void Sema::AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, } else { AddMethodCandidate(cast(Decl), FoundDecl, ActingContext, ObjectType, ObjectClassification, Args, CandidateSet, - SuppressUserConversions, false, std::nullopt, PO); + SuppressUserConversions, false, {}, PO); } } @@ -8125,7 +8125,7 @@ void Sema::AddConversionCandidate( } if (EnableIfAttr *FailedAttr = - CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) { + CheckEnableIf(Conversion, CandidateSet.getLocation(), {})) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_enable_if; Candidate.DeductionFailure.Data = FailedAttr; @@ -8306,7 +8306,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, } if (EnableIfAttr *FailedAttr = - CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) { + CheckEnableIf(Conversion, CandidateSet.getLocation(), {})) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_enable_if; Candidate.DeductionFailure.Data = FailedAttr; @@ -8346,10 +8346,10 @@ void Sema::AddNonMemberOperatorCandidates( continue; AddOverloadCandidate(FD, F.getPair(), FunctionArgs, CandidateSet); if (CandidateSet.getRewriteInfo().shouldAddReversed(*this, Args, FD)) - AddOverloadCandidate( - FD, F.getPair(), {FunctionArgs[1], FunctionArgs[0]}, CandidateSet, - false, false, true, false, ADLCallKind::NotADL, std::nullopt, - OverloadCandidateParamOrder::Reversed); + AddOverloadCandidate(FD, F.getPair(), + {FunctionArgs[1], FunctionArgs[0]}, CandidateSet, + false, false, true, false, ADLCallKind::NotADL, {}, + OverloadCandidateParamOrder::Reversed); } } } @@ -10102,8 +10102,7 @@ Sema::AddArgumentDependentLookupCandidates(DeclarationName Name, FD, FoundDecl, {Args[1], Args[0]}, CandidateSet, /*SuppressUserConversions=*/false, PartialOverloading, /*AllowExplicit=*/true, /*AllowExplicitConversion=*/false, - ADLCallKind::UsesADL, std::nullopt, - OverloadCandidateParamOrder::Reversed); + ADLCallKind::UsesADL, {}, OverloadCandidateParamOrder::Reversed); } } else { auto *FTD = cast(*I); @@ -15954,7 +15953,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, for (LookupResult::iterator Oper = R.begin(), OperEnd = R.end(); Oper != OperEnd; ++Oper) { AddMethodCandidate(Oper.getPair(), Base->getType(), Base->Classify(Context), - std::nullopt, CandidateSet, + {}, CandidateSet, /*SuppressUserConversion=*/false); } @@ -16149,8 +16148,7 @@ Sema::BuildForRangeBeginEndCall(SourceLocation Loc, *CallExpr = ExprError(); return FRS_DiagnosticIssued; } - *CallExpr = - BuildCallExpr(S, MemberRef.get(), Loc, std::nullopt, Loc, nullptr); + *CallExpr = BuildCallExpr(S, MemberRef.get(), Loc, {}, Loc, nullptr); if (CallExpr->isInvalid()) { *CallExpr = ExprError(); return FRS_DiagnosticIssued; diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 30ed47e6e56ec..c9379d25f7805 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -746,11 +746,11 @@ ExprResult ObjCPropertyOpBuilder::buildGet() { assert(InstanceReceiver || RefExpr->isSuperReceiver()); msg = S.ObjC().BuildInstanceMessageImplicit( InstanceReceiver, receiverType, GenericLoc, Getter->getSelector(), - Getter, std::nullopt); + Getter, {}); } else { msg = S.ObjC().BuildClassMessageImplicit( receiverType, RefExpr->isSuperReceiver(), GenericLoc, - Getter->getSelector(), Getter, std::nullopt); + Getter->getSelector(), Getter, {}); } return msg; } @@ -1131,7 +1131,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { /*TInfo=*/nullptr, SC_None, nullptr); - AtIndexGetter->setMethodParams(S.Context, Argument, std::nullopt); + AtIndexGetter->setMethodParams(S.Context, Argument, {}); } if (!AtIndexGetter) { @@ -1243,7 +1243,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { SC_None, nullptr); Params.push_back(key); - AtIndexSetter->setMethodParams(S.Context, Params, std::nullopt); + AtIndexSetter->setMethodParams(S.Context, Params, {}); } if (!AtIndexSetter) { diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 9e235a46707cd..38ae6d8116c3b 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -390,7 +390,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) { // type of the left operand could be used for SFINAE, so technically it is // *used*. if (DiagID != diag::warn_unused_comma_left_operand || !isSFINAEContext()) - DiagIfReachable(Loc, S ? llvm::ArrayRef(S) : std::nullopt, + DiagIfReachable(Loc, S ? llvm::ArrayRef(S) : llvm::ArrayRef(), PDiag(DiagID) << R1 << R2); } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 62f13610b5285..fcf05798d9c70 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2991,7 +2991,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier( // Fabricate an empty template parameter list for the invented header. return TemplateParameterList::Create(Context, SourceLocation(), - SourceLocation(), std::nullopt, + SourceLocation(), {}, SourceLocation(), nullptr); } diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp index 3a87128a7db0f..698e0760d808f 100644 --- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp +++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp @@ -1388,7 +1388,7 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, // additional function template derived as above from a hypothetical // constructor C(). if (!AddedAny) - Transform.buildSimpleDeductionGuide(std::nullopt); + Transform.buildSimpleDeductionGuide({}); // -- An additional function template derived as above from a hypothetical // constructor C(C), called the copy deduction candidate. diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 457a9968c32a4..8909c1ccba7c2 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -732,8 +732,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate( : InstantiatingTemplate( SemaRef, CodeSynthesisContext::RequirementInstantiation, PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr, - /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt, &DeductionInfo) { -} + /*Template=*/nullptr, /*TemplateArgs=*/{}, &DeductionInfo) {} Sema::InstantiatingTemplate::InstantiatingTemplate( Sema &SemaRef, SourceLocation PointOfInstantiation, @@ -742,7 +741,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate( : InstantiatingTemplate( SemaRef, CodeSynthesisContext::NestedRequirementConstraintsCheck, PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr, - /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt) {} + /*Template=*/nullptr, /*TemplateArgs=*/{}) {} Sema::InstantiatingTemplate::InstantiatingTemplate( Sema &SemaRef, SourceLocation PointOfInstantiation, const RequiresExpr *RE, @@ -750,8 +749,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate( : InstantiatingTemplate( SemaRef, CodeSynthesisContext::RequirementParameterInstantiation, PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr, - /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt, &DeductionInfo) { -} + /*Template=*/nullptr, /*TemplateArgs=*/{}, &DeductionInfo) {} Sema::InstantiatingTemplate::InstantiatingTemplate( Sema &SemaRef, SourceLocation PointOfInstantiation, diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index c44fc9c4194ca..19511cc51ba86 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -803,7 +803,7 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state, /*NumExceptions=*/0, /*NoexceptExpr=*/nullptr, /*ExceptionSpecTokens=*/nullptr, - /*DeclsInPrototype=*/std::nullopt, loc, loc, declarator)); + /*DeclsInPrototype=*/{}, loc, loc, declarator)); // For consistency, make sure the state still has us as processing // the decl spec. diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index bd474cc637a48..d24d8d5335e28 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3423,8 +3423,7 @@ class TreeTransform { ExprResult RebuildCXXScalarValueInitExpr(TypeSourceInfo *TSInfo, SourceLocation LParenLoc, SourceLocation RParenLoc) { - return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, std::nullopt, - RParenLoc, + return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, {}, RParenLoc, /*ListInitialization=*/false); } @@ -4243,13 +4242,13 @@ ExprResult TreeTransform::TransformInitializer(Expr *Init, // Revert value-initialization back to empty parens. if (CXXScalarValueInitExpr *VIE = dyn_cast(Init)) { SourceRange Parens = VIE->getSourceRange(); - return getDerived().RebuildParenListExpr(Parens.getBegin(), std::nullopt, + return getDerived().RebuildParenListExpr(Parens.getBegin(), {}, Parens.getEnd()); } // FIXME: We shouldn't build ImplicitValueInitExprs for direct-initialization. if (isa(Init)) - return getDerived().RebuildParenListExpr(SourceLocation(), std::nullopt, + return getDerived().RebuildParenListExpr(SourceLocation(), {}, SourceLocation()); // Revert initialization by constructor back to a parenthesized or braced list @@ -15444,7 +15443,7 @@ TreeTransform::TransformSizeOfPackExpr(SizeOfPackExpr *E) { return ExprError(); return getDerived().RebuildSizeOfPackExpr( E->getOperatorLoc(), Pack, E->getPackLoc(), E->getRParenLoc(), - std::nullopt, std::nullopt); + std::nullopt, {}); } // Try to compute the result without performing a partial substitution. @@ -15488,9 +15487,9 @@ TreeTransform::TransformSizeOfPackExpr(SizeOfPackExpr *E) { // Common case: we could determine the number of expansions without // substituting. if (Result) - return getDerived().RebuildSizeOfPackExpr( - E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(), - *Result, std::nullopt); + return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(), + E->getPackLoc(), + E->getRParenLoc(), *Result, {}); TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(), E->getPackLoc()); @@ -15521,7 +15520,7 @@ TreeTransform::TransformSizeOfPackExpr(SizeOfPackExpr *E) { return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(), - Args.size(), std::nullopt); + Args.size(), {}); } template @@ -15565,7 +15564,7 @@ TreeTransform::TransformPackIndexingExpr(PackIndexingExpr *E) { return ExprError(); return getDerived().RebuildPackIndexingExpr( E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(), - std::nullopt); + {}); } for (unsigned I = 0; I != *NumExpansions; ++I) { Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I); diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index f21cbd11b6ab8..b5fe16bf6e787 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -207,7 +207,7 @@ namespace clang { return Common->PartialSpecializations; } ArrayRef getPartialSpecializations(FunctionTemplateDecl::Common *) { - return std::nullopt; + return {}; } template diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 1efac6ac1c57f..0ead95083e0e3 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -554,7 +554,7 @@ std::optional CallEvent::getReturnValueUnderConstruction() const { ArrayRef AnyFunctionCall::parameters() const { const FunctionDecl *D = getDecl(); if (!D) - return std::nullopt; + return {}; return D->parameters(); } @@ -884,7 +884,7 @@ const BlockDataRegion *BlockCall::getBlockRegion() const { ArrayRef BlockCall::parameters() const { const BlockDecl *D = getDecl(); if (!D) - return std::nullopt; + return {}; return D->parameters(); } @@ -981,7 +981,7 @@ RuntimeDefinition CXXDestructorCall::getRuntimeDefinition() const { ArrayRef ObjCMethodCall::parameters() const { const ObjCMethodDecl *D = getDecl(); if (!D) - return std::nullopt; + return {}; return D->parameters(); } diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index 693791c3aee8b..0a29a050bbc2b 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1079,7 +1079,7 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D, T = getContext().VoidTy; if (!T->getAs()) { FunctionProtoType::ExtProtoInfo Ext; - T = getContext().getFunctionType(T, std::nullopt, Ext); + T = getContext().getFunctionType(T, {}, Ext); } T = getContext().getBlockPointerType(T); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 55dd3d7b69114..5475f7143db99 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4238,8 +4238,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename, LibclangInvocationReporter InvocationReporter( *CXXIdx, LibclangInvocationReporter::OperationKind::ParseOperation, - options, llvm::ArrayRef(*Args), /*InvocationArgs=*/std::nullopt, - unsaved_files); + options, llvm::ArrayRef(*Args), /*InvocationArgs=*/{}, unsaved_files); std::unique_ptr Unit = ASTUnit::LoadFromCommandLine( Args->data(), Args->data() + Args->size(), CXXIdx->getPCHContainerOperations(), Diags, diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp index 877bfce8b2709..aa859970302fa 100644 --- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp @@ -1370,9 +1370,9 @@ class UncheckedOptionalAccessTest new DiagnosticOptions()); TextDiagnostic TD(llvm::errs(), AO.ASTCtx.getLangOpts(), DiagOpts.get()); - TD.emitDiagnostic( - FullSourceLoc(Loc, SrcMgr), DiagnosticsEngine::Error, - "unexpected diagnostic", std::nullopt, std::nullopt); + TD.emitDiagnostic(FullSourceLoc(Loc, SrcMgr), + DiagnosticsEngine::Error, + "unexpected diagnostic", {}, {}); } } diff --git a/clang/unittests/Frontend/ASTUnitTest.cpp b/clang/unittests/Frontend/ASTUnitTest.cpp index 19b5d9bb41466..bd5d5d0098180 100644 --- a/clang/unittests/Frontend/ASTUnitTest.cpp +++ b/clang/unittests/Frontend/ASTUnitTest.cpp @@ -168,9 +168,9 @@ TEST_F(ASTUnitTest, LoadFromCommandLineEarlyError) { std::unique_ptr AST = ASTUnit::LoadFromCommandLine( &Args[0], &Args[4], PCHContainerOps, Diags, "", false, "", false, - CaptureDiagsKind::All, std::nullopt, true, 0, TU_Complete, false, false, - false, SkipFunctionBodiesScope::None, false, true, false, false, - std::nullopt, &ErrUnit, nullptr); + CaptureDiagsKind::All, {}, true, 0, TU_Complete, false, false, false, + SkipFunctionBodiesScope::None, false, true, false, false, std::nullopt, + &ErrUnit, nullptr); ASSERT_EQ(AST, nullptr); ASSERT_NE(ErrUnit, nullptr); @@ -195,9 +195,9 @@ TEST_F(ASTUnitTest, LoadFromCommandLineWorkingDirectory) { std::unique_ptr AST = ASTUnit::LoadFromCommandLine( &Args[0], &Args[4], PCHContainerOps, Diags, "", false, "", false, - CaptureDiagsKind::All, std::nullopt, true, 0, TU_Complete, false, false, - false, SkipFunctionBodiesScope::None, false, true, false, false, - std::nullopt, &ErrUnit, nullptr); + CaptureDiagsKind::All, {}, true, 0, TU_Complete, false, false, false, + SkipFunctionBodiesScope::None, false, true, false, false, std::nullopt, + &ErrUnit, nullptr); ASSERT_NE(AST, nullptr); ASSERT_FALSE(Diags->hasErrorOccurred()); diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp index adff7c70219bb..dd15c27df3eb7 100644 --- a/clang/utils/TableGen/NeonEmitter.cpp +++ b/clang/utils/TableGen/NeonEmitter.cpp @@ -1685,7 +1685,7 @@ Intrinsic::DagEmitter::emitDagShuffle(const DagInit *DI) { std::make_unique(Arg1.first.getElementSizeInBits())); ST.addExpander("MaskExpand", std::make_unique(Arg1.first.getNumElements())); - ST.evaluate(DI->getArg(2), Elts, std::nullopt); + ST.evaluate(DI->getArg(2), Elts, {}); std::string S = "__builtin_shufflevector(" + Arg1.second + ", " + Arg2.second; for (auto &E : Elts) {