[clang] Use {} instead of std::nullopt to initialize empty ArrayRef (#109399)

Follow up to #109133.
This commit is contained in:
Jay Foad 2024-10-24 10:23:40 +01:00 committed by GitHub
parent e37d736def
commit 4dd55c567a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
115 changed files with 376 additions and 435 deletions

View File

@ -80,7 +80,7 @@ public:
ArrayRef<T> copyArray(ArrayRef<T> Source) { ArrayRef<T> copyArray(ArrayRef<T> Source) {
if (!Source.empty()) if (!Source.empty())
return Source.copy(Allocator); return Source.copy(Allocator);
return std::nullopt; return {};
} }
ParagraphComment *actOnParagraphComment( ParagraphComment *actOnParagraphComment(

View File

@ -115,7 +115,7 @@ public:
static FriendDecl * static FriendDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_,
SourceLocation FriendL, SourceLocation EllipsisLoc = {}, SourceLocation FriendL, SourceLocation EllipsisLoc = {},
ArrayRef<TemplateParameterList *> FriendTypeTPLists = std::nullopt); ArrayRef<TemplateParameterList *> FriendTypeTPLists = {});
static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID, static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
unsigned FriendTypeNumTPLists); unsigned FriendTypeNumTPLists);

View File

@ -386,7 +386,7 @@ public:
/// If the method is implicit (not coming from source) \p SelLocs is /// If the method is implicit (not coming from source) \p SelLocs is
/// ignored. /// ignored.
void setMethodParams(ASTContext &C, ArrayRef<ParmVarDecl *> Params, void setMethodParams(ASTContext &C, ArrayRef<ParmVarDecl *> Params,
ArrayRef<SourceLocation> SelLocs = std::nullopt); ArrayRef<SourceLocation> SelLocs = {});
// Iterator access to parameter types. // Iterator access to parameter types.
struct GetTypeFn { struct GetTypeFn {

View File

@ -34,7 +34,7 @@ template <typename U> class OMPDeclarativeDirective : public U {
/// Get the clauses storage. /// Get the clauses storage.
MutableArrayRef<OMPClause *> getClauses() { MutableArrayRef<OMPClause *> getClauses() {
if (!Data) if (!Data)
return std::nullopt; return {};
return Data->getClauses(); return Data->getClauses();
} }
@ -90,7 +90,7 @@ public:
ArrayRef<OMPClause *> clauses() const { ArrayRef<OMPClause *> clauses() const {
if (!Data) if (!Data)
return std::nullopt; return {};
return Data->getClauses(); return Data->getClauses();
} }
}; };

View File

@ -4306,11 +4306,11 @@ class SizeOfPackExpr final
: Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {} : Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
public: public:
static SizeOfPackExpr * static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc,
Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, NamedDecl *Pack, SourceLocation PackLoc,
SourceLocation PackLoc, SourceLocation RParenLoc, SourceLocation RParenLoc,
std::optional<unsigned> Length = std::nullopt, std::optional<unsigned> Length = std::nullopt,
ArrayRef<TemplateArgument> PartialArgs = std::nullopt); ArrayRef<TemplateArgument> PartialArgs = {});
static SizeOfPackExpr *CreateDeserialized(ASTContext &Context, static SizeOfPackExpr *CreateDeserialized(ASTContext &Context,
unsigned NumPartialArgs); unsigned NumPartialArgs);

View File

@ -6108,14 +6108,14 @@ public:
return const_component_lists_iterator( return const_component_lists_iterator(
getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(), getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(),
getComponentsRef(), SupportsMapper, getComponentsRef(), SupportsMapper,
SupportsMapper ? getUDMapperRefs() : std::nullopt); SupportsMapper ? getUDMapperRefs() : ArrayRef<Expr *>());
} }
const_component_lists_iterator component_lists_end() const { const_component_lists_iterator component_lists_end() const {
return const_component_lists_iterator( return const_component_lists_iterator(
ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(), ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(),
MappableExprComponentListRef(getComponentsRef().end(), MappableExprComponentListRef(getComponentsRef().end(),
getComponentsRef().end()), getComponentsRef().end()),
SupportsMapper, std::nullopt); SupportsMapper, {});
} }
const_component_lists_range component_lists() const { const_component_lists_range component_lists() const {
return {component_lists_begin(), component_lists_end()}; return {component_lists_begin(), component_lists_end()};
@ -6128,7 +6128,7 @@ public:
return const_component_lists_iterator( return const_component_lists_iterator(
VD, getUniqueDeclsRef(), getDeclNumListsRef(), VD, getUniqueDeclsRef(), getDeclNumListsRef(),
getComponentListSizesRef(), getComponentsRef(), SupportsMapper, getComponentListSizesRef(), getComponentsRef(), SupportsMapper,
SupportsMapper ? getUDMapperRefs() : std::nullopt); SupportsMapper ? getUDMapperRefs() : ArrayRef<Expr *>());
} }
const_component_lists_iterator decl_component_lists_end() const { const_component_lists_iterator decl_component_lists_end() const {
return component_lists_end(); return component_lists_end();

View File

@ -277,7 +277,7 @@ class OMPExecutableDirective : public Stmt {
/// Get the clauses storage. /// Get the clauses storage.
MutableArrayRef<OMPClause *> getClauses() { MutableArrayRef<OMPClause *> getClauses() {
if (!Data) if (!Data)
return std::nullopt; return {};
return Data->getClauses(); return Data->getClauses();
} }
@ -572,7 +572,7 @@ public:
ArrayRef<OMPClause *> clauses() const { ArrayRef<OMPClause *> clauses() const {
if (!Data) if (!Data)
return std::nullopt; return {};
return Data->getClauses(); return Data->getClauses();
} }

View File

@ -283,7 +283,7 @@ public:
} }
static TemplateArgument getEmptyPack() { static TemplateArgument getEmptyPack() {
return TemplateArgument(std::nullopt); return TemplateArgument(ArrayRef<TemplateArgument>());
} }
/// Create a new template argument pack by copying the given set of /// Create a new template argument pack by copying the given set of

View File

@ -121,7 +121,7 @@ template <typename T> struct TypeListContainsSuperOf<EmptyTypeList, T> {
template <typename ResultT, typename ArgT, template <typename ResultT, typename ArgT,
ResultT (*Func)(ArrayRef<const ArgT *>)> ResultT (*Func)(ArrayRef<const ArgT *>)>
struct VariadicFunction { struct VariadicFunction {
ResultT operator()() const { return Func(std::nullopt); } ResultT operator()() const { return Func({}); }
template <typename... ArgsT> template <typename... ArgsT>
ResultT operator()(const ArgT &Arg1, const ArgsT &... Args) const { ResultT operator()(const ArgT &Arg1, const ArgsT &... Args) const {
@ -1949,35 +1949,35 @@ inline ArrayRef<TemplateArgument>
getTemplateSpecializationArgs(const FunctionDecl &FD) { getTemplateSpecializationArgs(const FunctionDecl &FD) {
if (const auto* TemplateArgs = FD.getTemplateSpecializationArgs()) if (const auto* TemplateArgs = FD.getTemplateSpecializationArgs())
return TemplateArgs->asArray(); return TemplateArgs->asArray();
return std::nullopt; return {};
} }
inline ArrayRef<TemplateArgumentLoc> inline ArrayRef<TemplateArgumentLoc>
getTemplateArgsWritten(const ClassTemplateSpecializationDecl &D) { getTemplateArgsWritten(const ClassTemplateSpecializationDecl &D) {
if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten()) if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten())
return Args->arguments(); return Args->arguments();
return std::nullopt; return {};
} }
inline ArrayRef<TemplateArgumentLoc> inline ArrayRef<TemplateArgumentLoc>
getTemplateArgsWritten(const VarTemplateSpecializationDecl &D) { getTemplateArgsWritten(const VarTemplateSpecializationDecl &D) {
if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten()) if (const ASTTemplateArgumentListInfo *Args = D.getTemplateArgsAsWritten())
return Args->arguments(); return Args->arguments();
return std::nullopt; return {};
} }
inline ArrayRef<TemplateArgumentLoc> inline ArrayRef<TemplateArgumentLoc>
getTemplateArgsWritten(const FunctionDecl &FD) { getTemplateArgsWritten(const FunctionDecl &FD) {
if (const auto *Args = FD.getTemplateSpecializationArgsAsWritten()) if (const auto *Args = FD.getTemplateSpecializationArgsAsWritten())
return Args->arguments(); return Args->arguments();
return std::nullopt; return {};
} }
inline ArrayRef<TemplateArgumentLoc> inline ArrayRef<TemplateArgumentLoc>
getTemplateArgsWritten(const DeclRefExpr &DRE) { getTemplateArgsWritten(const DeclRefExpr &DRE) {
if (const auto *Args = DRE.getTemplateArgs()) if (const auto *Args = DRE.getTemplateArgs())
return {Args, DRE.getNumTemplateArgs()}; return {Args, DRE.getNumTemplateArgs()};
return std::nullopt; return {};
} }
inline SmallVector<TemplateArgumentLoc> inline SmallVector<TemplateArgumentLoc>

View File

@ -1470,7 +1470,7 @@ public:
static bool classof(const SExpr *E) { return E->opcode() == COP_Return; } static bool classof(const SExpr *E) { return E->opcode() == COP_Return; }
/// Return an empty list. /// Return an empty list.
ArrayRef<BasicBlock *> successors() { return std::nullopt; } ArrayRef<BasicBlock *> successors() { return {}; }
SExpr *returnValue() { return Retval; } SExpr *returnValue() { return Retval; }
const SExpr *returnValue() const { return Retval; } const SExpr *returnValue() const { return Retval; }
@ -1496,7 +1496,7 @@ inline ArrayRef<BasicBlock*> Terminator::successors() {
case COP_Branch: return cast<Branch>(this)->successors(); case COP_Branch: return cast<Branch>(this)->successors();
case COP_Return: return cast<Return>(this)->successors(); case COP_Return: return cast<Return>(this)->successors();
default: default:
return std::nullopt; return {};
} }
} }

View File

@ -143,7 +143,7 @@ public:
/// \returns formal parameters for direct calls (including virtual calls) /// \returns formal parameters for direct calls (including virtual calls)
ArrayRef<ParmVarDecl *> parameters() const { ArrayRef<ParmVarDecl *> parameters() const {
if (!D) if (!D)
return std::nullopt; return {};
if (const auto *FD = dyn_cast<FunctionDecl>(D)) { if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
return FD->parameters(); return FD->parameters();
@ -152,7 +152,7 @@ public:
} else if (const auto *BD = dyn_cast<BlockDecl>(D)) { } else if (const auto *BD = dyn_cast<BlockDecl>(D)) {
return BD->parameters(); return BD->parameters();
} else { } else {
return std::nullopt; return {};
} }
} }

View File

@ -1858,11 +1858,9 @@ protected:
} }
virtual ArrayRef<const char *> getGCCRegNames() const = 0; virtual ArrayRef<const char *> getGCCRegNames() const = 0;
virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0; virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0;
virtual ArrayRef<AddlRegName> getGCCAddlRegNames() const { virtual ArrayRef<AddlRegName> getGCCAddlRegNames() const { return {}; }
return std::nullopt;
}
private: private:
// Assert the values for the fractional and integral bits for each fixed point // 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. // type follow the restrictions given in clause 6.2.6.3 of N1169.
void CheckFixedPointBits() const; void CheckFixedPointBits() const;

View File

@ -172,8 +172,7 @@ public:
Command(const Action &Source, const Tool &Creator, Command(const Action &Source, const Tool &Creator,
ResponseFileSupport ResponseSupport, const char *Executable, ResponseFileSupport ResponseSupport, const char *Executable,
const llvm::opt::ArgStringList &Arguments, ArrayRef<InputInfo> Inputs, const llvm::opt::ArgStringList &Arguments, ArrayRef<InputInfo> Inputs,
ArrayRef<InputInfo> Outputs = std::nullopt, ArrayRef<InputInfo> Outputs = {}, const char *PrependArg = nullptr);
const char *PrependArg = nullptr);
// FIXME: This really shouldn't be copyable, but is currently copied in some // FIXME: This really shouldn't be copyable, but is currently copied in some
// error handling in Driver::generateCompilationDiagnostics. // error handling in Driver::generateCompilationDiagnostics.
Command(const Command &) = default; Command(const Command &) = default;
@ -245,8 +244,7 @@ public:
CC1Command(const Action &Source, const Tool &Creator, CC1Command(const Action &Source, const Tool &Creator,
ResponseFileSupport ResponseSupport, const char *Executable, ResponseFileSupport ResponseSupport, const char *Executable,
const llvm::opt::ArgStringList &Arguments, const llvm::opt::ArgStringList &Arguments,
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs = {},
ArrayRef<InputInfo> Outputs = std::nullopt,
const char *PrependArg = nullptr); const char *PrependArg = nullptr);
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,

View File

@ -836,7 +836,7 @@ public:
bool StorePreamblesInMemory = false, bool StorePreamblesInMemory = false,
StringRef PreambleStoragePath = StringRef(), bool OnlyLocalDecls = false, StringRef PreambleStoragePath = StringRef(), bool OnlyLocalDecls = false,
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
ArrayRef<RemappedFile> RemappedFiles = std::nullopt, ArrayRef<RemappedFile> RemappedFiles = {},
bool RemappedFilesKeepOriginalName = true, bool RemappedFilesKeepOriginalName = true,
unsigned PrecompilePreambleAfterNParses = 0, unsigned PrecompilePreambleAfterNParses = 0,
TranslationUnitKind TUKind = TU_Complete, TranslationUnitKind TUKind = TU_Complete,
@ -864,7 +864,7 @@ public:
/// \returns True if a failure occurred that causes the ASTUnit not to /// \returns True if a failure occurred that causes the ASTUnit not to
/// contain any translation-unit information, false otherwise. /// contain any translation-unit information, false otherwise.
bool Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps, bool Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
ArrayRef<RemappedFile> RemappedFiles = std::nullopt, ArrayRef<RemappedFile> RemappedFiles = {},
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr); IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
/// Free data that will be re-generated on the next parse. /// Free data that will be re-generated on the next parse.

View File

@ -911,7 +911,7 @@ private:
getActiveModuleMacros(Preprocessor &PP, const IdentifierInfo *II) const { getActiveModuleMacros(Preprocessor &PP, const IdentifierInfo *II) const {
if (auto *Info = getModuleInfo(PP, II)) if (auto *Info = getModuleInfo(PP, II))
return Info->ActiveModuleMacros; return Info->ActiveModuleMacros;
return std::nullopt; return {};
} }
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc, MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
@ -935,7 +935,7 @@ private:
ArrayRef<ModuleMacro*> getOverriddenMacros() const { ArrayRef<ModuleMacro*> getOverriddenMacros() const {
if (auto *Info = State.dyn_cast<ModuleMacroInfo*>()) if (auto *Info = State.dyn_cast<ModuleMacroInfo*>())
return Info->OverriddenMacros; return Info->OverriddenMacros;
return std::nullopt; return {};
} }
void setOverriddenMacros(Preprocessor &PP, void setOverriddenMacros(Preprocessor &PP,
@ -1444,7 +1444,7 @@ public:
auto I = LeafModuleMacros.find(II); auto I = LeafModuleMacros.find(II);
if (I != LeafModuleMacros.end()) if (I != LeafModuleMacros.end())
return I->second; return I->second;
return std::nullopt; return {};
} }
/// Get the list of submodules that we're currently building. /// Get the list of submodules that we're currently building.

View File

@ -375,12 +375,11 @@ private:
public: public:
/// Construct a new code-completion context of the given kind. /// Construct a new code-completion context of the given kind.
CodeCompletionContext(Kind CCKind) 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. /// Construct a new code-completion context of the given kind.
CodeCompletionContext( CodeCompletionContext(Kind CCKind, QualType T,
Kind CCKind, QualType T, ArrayRef<const IdentifierInfo *> SelIdents = {})
ArrayRef<const IdentifierInfo *> SelIdents = std::nullopt)
: CCKind(CCKind), IsUsingDeclaration(false), SelIdents(SelIdents) { : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(SelIdents) {
if (CCKind == CCC_DotMemberAccess || CCKind == CCC_ArrowMemberAccess || if (CCKind == CCC_DotMemberAccess || CCKind == CCC_ArrowMemberAccess ||
CCKind == CCC_ObjCPropertyAccess || CCKind == CCC_ObjCClassMessage || CCKind == CCC_ObjCPropertyAccess || CCKind == CCC_ObjCClassMessage ||

View File

@ -1206,9 +1206,8 @@ class Sema;
/// Add a new candidate with NumConversions conversion sequence slots /// Add a new candidate with NumConversions conversion sequence slots
/// to the overload set. /// to the overload set.
OverloadCandidate & OverloadCandidate &addCandidate(unsigned NumConversions = 0,
addCandidate(unsigned NumConversions = 0, ConversionSequenceList Conversions = {}) {
ConversionSequenceList Conversions = std::nullopt) {
assert((Conversions.empty() || Conversions.size() == NumConversions) && assert((Conversions.empty() || Conversions.size() == NumConversions) &&
"preallocated conversion sequence has wrong length"); "preallocated conversion sequence has wrong length");

View File

@ -3478,10 +3478,12 @@ public:
/// a C++0x [dcl.typedef]p2 alias-declaration: 'using T = A;'. /// a C++0x [dcl.typedef]p2 alias-declaration: 'using T = A;'.
NamedDecl *ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, NamedDecl *ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D,
LookupResult &Previous, bool &Redeclaration); LookupResult &Previous, bool &Redeclaration);
NamedDecl *ActOnVariableDeclarator( NamedDecl *ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, TypeSourceInfo *TInfo,
LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, LookupResult &Previous,
bool &AddToScope, ArrayRef<BindingDecl *> Bindings = std::nullopt); MultiTemplateParamsArg TemplateParamLists,
bool &AddToScope,
ArrayRef<BindingDecl *> Bindings = {});
/// Perform semantic checking on a newly-created variable /// Perform semantic checking on a newly-created variable
/// declaration. /// declaration.
@ -5325,9 +5327,8 @@ public:
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
CXXCtorInitializer *Initializer); CXXCtorInitializer *Initializer);
bool SetCtorInitializers( bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef<CXXCtorInitializer *> Initializers = {});
ArrayRef<CXXCtorInitializer *> Initializers = std::nullopt);
/// MarkBaseAndMemberDestructorsReferenced - Given a record decl, /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
/// mark all the non-trivial destructors of its members and bases as /// mark all the non-trivial destructors of its members and bases as
@ -6623,9 +6624,9 @@ public:
/// \param SkipLocalVariables If true, don't mark local variables as /// \param SkipLocalVariables If true, don't mark local variables as
/// 'referenced'. /// 'referenced'.
/// \param StopAt Subexpressions that we shouldn't recurse into. /// \param StopAt Subexpressions that we shouldn't recurse into.
void MarkDeclarationsReferencedInExpr( void MarkDeclarationsReferencedInExpr(Expr *E,
Expr *E, bool SkipLocalVariables = false, bool SkipLocalVariables = false,
ArrayRef<const Expr *> StopAt = std::nullopt); ArrayRef<const Expr *> StopAt = {});
/// Try to convert an expression \p E to type \p Ty. Returns the result of the /// Try to convert an expression \p E to type \p Ty. Returns the result of the
/// conversion. /// conversion.
@ -6696,7 +6697,7 @@ public:
DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
CorrectionCandidateCallback &CCC, CorrectionCandidateCallback &CCC,
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr, TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
ArrayRef<Expr *> Args = std::nullopt, ArrayRef<Expr *> Args = {},
DeclContext *LookupCtx = nullptr, DeclContext *LookupCtx = nullptr,
TypoExpr **Out = nullptr); TypoExpr **Out = nullptr);
@ -10124,15 +10125,17 @@ public:
/// \param PartialOverloading true if we are performing "partial" overloading /// \param PartialOverloading true if we are performing "partial" overloading
/// based on an incomplete set of function arguments. This feature is used by /// based on an incomplete set of function arguments. This feature is used by
/// code completion. /// code completion.
void AddOverloadCandidate( void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl,
FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef<Expr *> Args, ArrayRef<Expr *> Args,
OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false, OverloadCandidateSet &CandidateSet,
bool PartialOverloading = false, bool AllowExplicit = true, bool SuppressUserConversions = false,
bool AllowExplicitConversion = false, bool PartialOverloading = false,
ADLCallKind IsADLCandidate = ADLCallKind::NotADL, bool AllowExplicit = true,
ConversionSequenceList EarlyConversions = std::nullopt, bool AllowExplicitConversion = false,
OverloadCandidateParamOrder PO = {}, ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
bool AggregateCandidateDeduction = false); ConversionSequenceList EarlyConversions = {},
OverloadCandidateParamOrder PO = {},
bool AggregateCandidateDeduction = false);
/// Add all of the function declarations in the given function set to /// Add all of the function declarations in the given function set to
/// the overload candidate set. /// the overload candidate set.
@ -10159,15 +10162,15 @@ public:
/// both @c a1 and @c a2. If @p SuppressUserConversions, then don't /// both @c a1 and @c a2. If @p SuppressUserConversions, then don't
/// allow user-defined conversions via constructors or conversion /// allow user-defined conversions via constructors or conversion
/// operators. /// operators.
void void AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, QualType ObjectType,
CXXRecordDecl *ActingContext, QualType ObjectType, Expr::Classification ObjectClassification,
Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet, OverloadCandidateSet &CandidateSet,
bool SuppressUserConversions = false, bool SuppressUserConversions = false,
bool PartialOverloading = false, bool PartialOverloading = false,
ConversionSequenceList EarlyConversions = std::nullopt, ConversionSequenceList EarlyConversions = {},
OverloadCandidateParamOrder PO = {}); OverloadCandidateParamOrder PO = {});
/// Add a C++ member function template as a candidate to the candidate /// Add a C++ member function template as a candidate to the candidate
/// set, using template argument deduction to produce an appropriate member /// set, using template argument deduction to produce an appropriate member
@ -12968,12 +12971,13 @@ public:
bool CheckInstantiationDepth(SourceLocation PointOfInstantiation, bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
SourceRange InstantiationRange); SourceRange InstantiationRange);
InstantiatingTemplate( InstantiatingTemplate(Sema &SemaRef,
Sema &SemaRef, CodeSynthesisContext::SynthesisKind Kind, CodeSynthesisContext::SynthesisKind Kind,
SourceLocation PointOfInstantiation, SourceRange InstantiationRange, SourceLocation PointOfInstantiation,
Decl *Entity, NamedDecl *Template = nullptr, SourceRange InstantiationRange, Decl *Entity,
ArrayRef<TemplateArgument> TemplateArgs = std::nullopt, NamedDecl *Template = nullptr,
sema::TemplateDeductionInfo *DeductionInfo = nullptr); ArrayRef<TemplateArgument> TemplateArgs = {},
sema::TemplateDeductionInfo *DeductionInfo = nullptr);
InstantiatingTemplate(const InstantiatingTemplate &) = delete; InstantiatingTemplate(const InstantiatingTemplate &) = delete;

View File

@ -336,8 +336,8 @@ public:
ObjCInterfaceDecl *ID); ObjCInterfaceDecl *ID);
Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd, Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
ArrayRef<Decl *> allMethods = std::nullopt, ArrayRef<Decl *> allMethods = {},
ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt); ArrayRef<DeclGroupPtrTy> allTUVars = {});
struct ObjCArgInfo { struct ObjCArgInfo {
IdentifierInfo *Name; IdentifierInfo *Name;

View File

@ -274,7 +274,7 @@ public:
"Parsed clause kind does not have a queue id expr list"); "Parsed clause kind does not have a queue id expr list");
if (std::holds_alternative<std::monostate>(Details)) if (std::holds_alternative<std::monostate>(Details))
return ArrayRef<Expr *>{std::nullopt}; return ArrayRef<Expr *>();
return std::get<WaitDetails>(Details).QueueIdExprs; return std::get<WaitDetails>(Details).QueueIdExprs;
} }

View File

@ -1196,21 +1196,21 @@ public:
SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc,
SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId, const DeclarationNameInfo &ReductionId,
ArrayRef<Expr *> UnresolvedReductions = std::nullopt); ArrayRef<Expr *> UnresolvedReductions = {});
/// Called on well-formed 'task_reduction' clause. /// Called on well-formed 'task_reduction' clause.
OMPClause *ActOnOpenMPTaskReductionClause( OMPClause *ActOnOpenMPTaskReductionClause(
ArrayRef<Expr *> VarList, SourceLocation StartLoc, ArrayRef<Expr *> VarList, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
CXXScopeSpec &ReductionIdScopeSpec, CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId, const DeclarationNameInfo &ReductionId,
ArrayRef<Expr *> UnresolvedReductions = std::nullopt); ArrayRef<Expr *> UnresolvedReductions = {});
/// Called on well-formed 'in_reduction' clause. /// Called on well-formed 'in_reduction' clause.
OMPClause *ActOnOpenMPInReductionClause( OMPClause *ActOnOpenMPInReductionClause(
ArrayRef<Expr *> VarList, SourceLocation StartLoc, ArrayRef<Expr *> VarList, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
CXXScopeSpec &ReductionIdScopeSpec, CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId, const DeclarationNameInfo &ReductionId,
ArrayRef<Expr *> UnresolvedReductions = std::nullopt); ArrayRef<Expr *> UnresolvedReductions = {});
/// Called on well-formed 'linear' clause. /// Called on well-formed 'linear' clause.
OMPClause *ActOnOpenMPLinearClause( OMPClause *ActOnOpenMPLinearClause(
ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc, ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
@ -1263,7 +1263,7 @@ public:
OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs, bool NoDiagnose = false, const OMPVarListLocTy &Locs, bool NoDiagnose = false,
ArrayRef<Expr *> UnresolvedMappers = std::nullopt); ArrayRef<Expr *> UnresolvedMappers = {});
/// Called on well-formed 'num_teams' clause. /// Called on well-formed 'num_teams' clause.
OMPClause *ActOnOpenMPNumTeamsClause(ArrayRef<Expr *> VarList, OMPClause *ActOnOpenMPNumTeamsClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc, SourceLocation StartLoc,
@ -1295,7 +1295,7 @@ public:
CXXScopeSpec &MapperIdScopeSpec, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc, DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs, ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers = std::nullopt); ArrayRef<Expr *> UnresolvedMappers = {});
/// Called on well-formed 'from' clause. /// Called on well-formed 'from' clause.
OMPClause * OMPClause *
ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers, ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
@ -1303,7 +1303,7 @@ public:
CXXScopeSpec &MapperIdScopeSpec, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc, DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs, ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers = std::nullopt); ArrayRef<Expr *> UnresolvedMappers = {});
/// Called on well-formed 'use_device_ptr' clause. /// Called on well-formed 'use_device_ptr' clause.
OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList, OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs); const OMPVarListLocTy &Locs);

View File

@ -644,14 +644,14 @@ public:
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker, void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker,
StringRef BugName, StringRef BugCategory, StringRef BugName, StringRef BugCategory,
StringRef BugStr, PathDiagnosticLocation Loc, StringRef BugStr, PathDiagnosticLocation Loc,
ArrayRef<SourceRange> Ranges = std::nullopt, ArrayRef<SourceRange> Ranges = {},
ArrayRef<FixItHint> Fixits = std::nullopt); ArrayRef<FixItHint> Fixits = {});
void EmitBasicReport(const Decl *DeclWithIssue, CheckerNameRef CheckerName, void EmitBasicReport(const Decl *DeclWithIssue, CheckerNameRef CheckerName,
StringRef BugName, StringRef BugCategory, StringRef BugName, StringRef BugCategory,
StringRef BugStr, PathDiagnosticLocation Loc, StringRef BugStr, PathDiagnosticLocation Loc,
ArrayRef<SourceRange> Ranges = std::nullopt, ArrayRef<SourceRange> Ranges = {},
ArrayRef<FixItHint> Fixits = std::nullopt); ArrayRef<FixItHint> Fixits = {});
private: private:
llvm::StringMap<std::unique_ptr<BugType>> StrBugTypes; llvm::StringMap<std::unique_ptr<BugType>> StrBugTypes;

View File

@ -74,7 +74,7 @@ public:
bool clearDiagnostic(ArrayRef<unsigned> IDs, SourceRange range); bool clearDiagnostic(ArrayRef<unsigned> IDs, SourceRange range);
bool clearAllDiagnostics(SourceRange range) { bool clearAllDiagnostics(SourceRange range) {
return clearDiagnostic(std::nullopt, range); return clearDiagnostic({}, range);
} }
bool clearDiagnostic(unsigned ID1, unsigned ID2, SourceRange range) { bool clearDiagnostic(unsigned ID1, unsigned ID2, SourceRange range) {
unsigned IDs[] = { ID1, ID2 }; unsigned IDs[] = { ID1, ID2 };

View File

@ -1052,7 +1052,7 @@ ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) {
auto MergedIt = auto MergedIt =
MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl())); MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl()));
if (MergedIt == MergedDefModules.end()) if (MergedIt == MergedDefModules.end())
return std::nullopt; return {};
return MergedIt->second; return MergedIt->second;
} }
@ -1111,7 +1111,7 @@ void ASTContext::addLazyModuleInitializers(Module *M,
ArrayRef<Decl *> ASTContext::getModuleInitializers(Module *M) { ArrayRef<Decl *> ASTContext::getModuleInitializers(Module *M) {
auto It = ModuleInitializers.find(M); auto It = ModuleInitializers.find(M);
if (It == ModuleInitializers.end()) if (It == ModuleInitializers.end())
return std::nullopt; return {};
auto *Inits = It->second; auto *Inits = It->second;
Inits->resolve(*this); Inits->resolve(*this);

View File

@ -210,7 +210,7 @@ void DeclInfo::fill() {
IsInstanceMethod = false; IsInstanceMethod = false;
IsClassMethod = false; IsClassMethod = false;
IsVariadic = false; IsVariadic = false;
ParamVars = std::nullopt; ParamVars = {};
TemplateParameters = nullptr; TemplateParameters = nullptr;
if (!CommentDecl) { if (!CommentDecl) {

View File

@ -499,7 +499,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
if (isTokBlockCommand()) { if (isTokBlockCommand()) {
// Block command ahead. We can't nest block commands, so pretend that this // Block command ahead. We can't nest block commands, so pretend that this
// command has an empty argument. // command has an empty argument.
ParagraphComment *Paragraph = S.actOnParagraphComment(std::nullopt); ParagraphComment *Paragraph = S.actOnParagraphComment({});
if (PC) { if (PC) {
S.actOnParamCommandFinish(PC, Paragraph); S.actOnParamCommandFinish(PC, Paragraph);
return PC; return PC;
@ -547,7 +547,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
ParagraphComment *Paragraph; ParagraphComment *Paragraph;
if (EmptyParagraph) if (EmptyParagraph)
Paragraph = S.actOnParagraphComment(std::nullopt); Paragraph = S.actOnParagraphComment({});
else { else {
BlockContentComment *Block = parseParagraphOrBlockCommand(); BlockContentComment *Block = parseParagraphOrBlockCommand();
// Since we have checked for a block command, we should have parsed a // Since we have checked for a block command, we should have parsed a

View File

@ -5506,9 +5506,8 @@ IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C, IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { GlobalDeclID ID) {
return new (C, ID) return new (C, ID) IndirectFieldDecl(C, nullptr, SourceLocation(),
IndirectFieldDecl(C, nullptr, SourceLocation(), DeclarationName(), DeclarationName(), QualType(), {});
QualType(), std::nullopt);
} }
SourceRange EnumConstantDecl::getSourceRange() const { SourceRange EnumConstantDecl::getSourceRange() const {
@ -5748,7 +5747,7 @@ ImportDecl *ImportDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
ArrayRef<SourceLocation> ImportDecl::getIdentifierLocs() const { ArrayRef<SourceLocation> ImportDecl::getIdentifierLocs() const {
if (!isImportComplete()) if (!isImportComplete())
return std::nullopt; return {};
const auto *StoredLocs = getTrailingObjects<SourceLocation>(); const auto *StoredLocs = getTrailingObjects<SourceLocation>();
return llvm::ArrayRef(StoredLocs, return llvm::ArrayRef(StoredLocs,

View File

@ -3293,8 +3293,7 @@ UsingPackDecl *UsingPackDecl::Create(ASTContext &C, DeclContext *DC,
UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
unsigned NumExpansions) { unsigned NumExpansions) {
size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions); size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
auto *Result = auto *Result = new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, {});
new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, std::nullopt);
Result->NumExpansions = NumExpansions; Result->NumExpansions = NumExpansions;
auto *Trail = Result->getTrailingObjects<NamedDecl *>(); auto *Trail = Result->getTrailingObjects<NamedDecl *>();
for (unsigned I = 0; I != NumExpansions; ++I) for (unsigned I = 0; I != NumExpansions; ++I)
@ -3443,7 +3442,7 @@ DecompositionDecl *DecompositionDecl::CreateDeserialized(ASTContext &C,
size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings); size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
auto *Result = new (C, ID, Extra) auto *Result = new (C, ID, Extra)
DecompositionDecl(C, nullptr, SourceLocation(), SourceLocation(), DecompositionDecl(C, nullptr, SourceLocation(), SourceLocation(),
QualType(), nullptr, StorageClass(), std::nullopt); QualType(), nullptr, StorageClass(), {});
// Set up and clean out the bindings array. // Set up and clean out the bindings array.
Result->NumBindings = NumBindings; Result->NumBindings = NumBindings;
auto *Trail = Result->getTrailingObjects<BindingDecl *>(); auto *Trail = Result->getTrailingObjects<BindingDecl *>();

View File

@ -947,12 +947,12 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,
assert((!SelLocs.empty() || isImplicit()) && assert((!SelLocs.empty() || isImplicit()) &&
"No selector locs for non-implicit method"); "No selector locs for non-implicit method");
if (isImplicit()) if (isImplicit())
return setParamsAndSelLocs(C, Params, std::nullopt); return setParamsAndSelLocs(C, Params, {});
setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params, setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params,
DeclEndLoc)); DeclEndLoc));
if (getSelLocsKind() != SelLoc_NonStandard) if (getSelLocsKind() != SelLoc_NonStandard)
return setParamsAndSelLocs(C, Params, std::nullopt); return setParamsAndSelLocs(C, Params, {});
setParamsAndSelLocs(C, Params, SelLocs); setParamsAndSelLocs(C, Params, SelLocs);
} }

View File

@ -30,7 +30,7 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
SourceLocation L, SourceLocation L,
ArrayRef<Expr *> VL) { ArrayRef<Expr *> VL) {
auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>( auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>(
C, DC, std::nullopt, VL.size(), L); C, DC, {}, VL.size(), L);
D->setVars(VL); D->setVars(VL);
return D; return D;
} }

View File

@ -794,8 +794,7 @@ NonTypeTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>( additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>(
NumExpandedTypes, HasTypeConstraint ? 1 : 0)) NumExpandedTypes, HasTypeConstraint ? 1 : 0))
NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(), NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(),
0, 0, nullptr, QualType(), nullptr, 0, 0, nullptr, QualType(), nullptr, {}, {});
std::nullopt, std::nullopt);
NTTP->NumExpandedTypes = NumExpandedTypes; NTTP->NumExpandedTypes = NumExpandedTypes;
return NTTP; return NTTP;
} }
@ -870,7 +869,7 @@ TemplateTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
auto *TTP = auto *TTP =
new (C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions)) new (C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr, TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr,
false, nullptr, std::nullopt); false, nullptr, {});
TTP->NumExpandedParams = NumExpansions; TTP->NumExpandedParams = NumExpansions;
return TTP; return TTP;
} }

View File

@ -4720,8 +4720,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
OK_Ordinary) { OK_Ordinary) {
BaseAndUpdaterExprs[0] = baseExpr; BaseAndUpdaterExprs[0] = baseExpr;
InitListExpr *ILE = InitListExpr *ILE = new (C) InitListExpr(C, lBraceLoc, {}, rBraceLoc);
new (C) InitListExpr(C, lBraceLoc, std::nullopt, rBraceLoc);
ILE->setType(baseExpr->getType()); ILE->setType(baseExpr->getType());
BaseAndUpdaterExprs[1] = ILE; BaseAndUpdaterExprs[1] = ILE;

View File

@ -397,7 +397,7 @@ public:
void mangleBits(llvm::APInt Number); void mangleBits(llvm::APInt Number);
void mangleTagTypeKind(TagTypeKind TK); void mangleTagTypeKind(TagTypeKind TK);
void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName, void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName,
ArrayRef<StringRef> NestedNames = std::nullopt); ArrayRef<StringRef> NestedNames = {});
void mangleAddressSpaceType(QualType T, Qualifiers Quals, SourceRange Range); void mangleAddressSpaceType(QualType T, Qualifiers Quals, SourceRange Range);
void mangleType(QualType T, SourceRange Range, void mangleType(QualType T, SourceRange Range,
QualifierMangleMode QMM = QMM_Mangle); QualifierMangleMode QMM = QMM_Mangle);

View File

@ -452,8 +452,7 @@ OMPReverseDirective::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation EndLoc, Stmt *AssociatedStmt, SourceLocation EndLoc, Stmt *AssociatedStmt,
Stmt *TransformedStmt, Stmt *PreInits) { Stmt *TransformedStmt, Stmt *PreInits) {
OMPReverseDirective *Dir = createDirective<OMPReverseDirective>( OMPReverseDirective *Dir = createDirective<OMPReverseDirective>(
C, std::nullopt, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, C, {}, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc);
EndLoc);
Dir->setTransformedStmt(TransformedStmt); Dir->setTransformedStmt(TransformedStmt);
Dir->setPreInits(PreInits); Dir->setPreInits(PreInits);
return Dir; return Dir;
@ -555,7 +554,7 @@ OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
Stmt *AssociatedStmt, Stmt *AssociatedStmt,
bool HasCancel) { bool HasCancel) {
auto *Dir = auto *Dir =
createDirective<OMPSectionDirective>(C, std::nullopt, AssociatedStmt, createDirective<OMPSectionDirective>(C, {}, AssociatedStmt,
/*NumChildren=*/0, StartLoc, EndLoc); /*NumChildren=*/0, StartLoc, EndLoc);
Dir->setHasCancel(HasCancel); Dir->setHasCancel(HasCancel);
return Dir; return Dir;
@ -605,7 +604,7 @@ OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
SourceLocation StartLoc, SourceLocation StartLoc,
SourceLocation EndLoc, SourceLocation EndLoc,
Stmt *AssociatedStmt) { Stmt *AssociatedStmt) {
return createDirective<OMPMasterDirective>(C, std::nullopt, AssociatedStmt, return createDirective<OMPMasterDirective>(C, {}, AssociatedStmt,
/*NumChildren=*/0, StartLoc, /*NumChildren=*/0, StartLoc,
EndLoc); EndLoc);
} }

View File

@ -542,7 +542,7 @@ static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) {
CallExpr *CE = CallExpr::Create( CallExpr *CE = CallExpr::Create(
/*ASTContext=*/C, /*ASTContext=*/C,
/*StmtClass=*/M.makeLvalueToRvalue(/*Expr=*/Block), /*StmtClass=*/M.makeLvalueToRvalue(/*Expr=*/Block),
/*Args=*/std::nullopt, /*Args=*/{},
/*QualType=*/C.VoidTy, /*QualType=*/C.VoidTy,
/*ExprValueType=*/VK_PRValue, /*ExprValueType=*/VK_PRValue,
/*SourceLocation=*/SourceLocation(), FPOptionsOverride()); /*SourceLocation=*/SourceLocation(), FPOptionsOverride());
@ -610,7 +610,7 @@ static Stmt *create_dispatch_sync(ASTContext &C, const FunctionDecl *D) {
ASTMaker M(C); ASTMaker M(C);
DeclRefExpr *DR = M.makeDeclRefExpr(PV); DeclRefExpr *DR = M.makeDeclRefExpr(PV);
ImplicitCastExpr *ICE = M.makeLvalueToRvalue(DR, Ty); 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()); SourceLocation(), FPOptionsOverride());
return CE; return CE;
} }

View File

@ -3605,7 +3605,7 @@ public:
auto It = VarGrpMap.find(Var); auto It = VarGrpMap.find(Var);
if (It == VarGrpMap.end()) if (It == VarGrpMap.end())
return std::nullopt; return {};
return Groups[It->second]; return Groups[It->second];
} }

View File

@ -122,7 +122,7 @@ public:
ArrayRef<const char *> getGCCRegNames() const override; ArrayRef<const char *> getGCCRegNames() const override;
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
/// Accepted register names: (n, m is unsigned integer, n < m) /// Accepted register names: (n, m is unsigned integer, n < m)

View File

@ -40,9 +40,7 @@ public:
void getTargetDefines(const LangOptions &Opts, void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override; MacroBuilder &Builder) const override;
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
BuiltinVaListKind getBuiltinVaListKind() const override { BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList; return TargetInfo::VoidPtrBuiltinVaList;
@ -60,7 +58,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,

View File

@ -63,9 +63,7 @@ public:
void getTargetDefines(const LangOptions &Opts, void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override; MacroBuilder &Builder) const override;
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
bool allowsLargerPreferedTypeAlignment() const override { return false; } bool allowsLargerPreferedTypeAlignment() const override { return false; }
@ -84,7 +82,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override { ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override {

View File

@ -67,9 +67,7 @@ public:
} }
bool isValidGCCRegisterName(StringRef Name) const override { return true; } bool isValidGCCRegisterName(StringRef Name) const override { return true; }
ArrayRef<const char *> getGCCRegNames() const override { ArrayRef<const char *> getGCCRegNames() const override { return {}; }
return std::nullopt;
}
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override { TargetInfo::ConstraintInfo &Info) const override {
@ -86,7 +84,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
bool allowDebugInfoForExternalRef() const override { return true; } bool allowDebugInfoForExternalRef() const override { return true; }

View File

@ -72,15 +72,11 @@ public:
return Feature == "directx"; return Feature == "directx";
} }
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
std::string_view getClobbers() const override { return ""; } std::string_view getClobbers() const override { return ""; }
ArrayRef<const char *> getGCCRegNames() const override { ArrayRef<const char *> getGCCRegNames() const override { return {}; }
return std::nullopt;
}
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override { TargetInfo::ConstraintInfo &info) const override {
@ -88,7 +84,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
BuiltinVaListKind getBuiltinVaListKind() const override { BuiltinVaListKind getBuiltinVaListKind() const override {

View File

@ -78,9 +78,7 @@ public:
return TargetInfo::VoidPtrBuiltinVaList; return TargetInfo::VoidPtrBuiltinVaList;
} }
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override { TargetInfo::ConstraintInfo &info) const override {

View File

@ -117,7 +117,7 @@ void M68kTargetInfo::getTargetDefines(const LangOptions &Opts,
ArrayRef<Builtin::Info> M68kTargetInfo::getTargetBuiltins() const { ArrayRef<Builtin::Info> M68kTargetInfo::getTargetBuiltins() const {
// FIXME: Implement. // FIXME: Implement.
return std::nullopt; return {};
} }
bool M68kTargetInfo::hasFeature(StringRef Feature) const { bool M68kTargetInfo::hasFeature(StringRef Feature) const {

View File

@ -52,7 +52,7 @@ public:
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override {
// FIXME: Implement. // FIXME: Implement.
return std::nullopt; return {};
} }
bool allowsLargerPreferedTypeAlignment() const override { return false; } bool allowsLargerPreferedTypeAlignment() const override { return false; }

View File

@ -93,7 +93,7 @@ public:
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases. // No aliases.
return std::nullopt; return {};
} }
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,

View File

@ -16,12 +16,10 @@
using namespace clang; using namespace clang;
using namespace clang::targets; using namespace clang::targets;
ArrayRef<const char *> PNaClTargetInfo::getGCCRegNames() const { ArrayRef<const char *> PNaClTargetInfo::getGCCRegNames() const { return {}; }
return std::nullopt;
}
ArrayRef<TargetInfo::GCCRegAlias> PNaClTargetInfo::getGCCRegAliases() const { ArrayRef<TargetInfo::GCCRegAlias> PNaClTargetInfo::getGCCRegAliases() const {
return std::nullopt; return {};
} }
void PNaClTargetInfo::getArchDefines(const LangOptions &Opts, void PNaClTargetInfo::getArchDefines(const LangOptions &Opts,

View File

@ -52,9 +52,7 @@ public:
return Feature == "pnacl"; return Feature == "pnacl";
} }
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
BuiltinVaListKind getBuiltinVaListKind() const override { BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::PNaClABIBuiltinVaList; return TargetInfo::PNaClABIBuiltinVaList;

View File

@ -159,15 +159,11 @@ public:
// memcpy as per section 3 of the SPIR spec. // memcpy as per section 3 of the SPIR spec.
bool useFP16ConversionIntrinsics() const override { return false; } bool useFP16ConversionIntrinsics() const override { return false; }
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
std::string_view getClobbers() const override { return ""; } std::string_view getClobbers() const override { return ""; }
ArrayRef<const char *> getGCCRegNames() const override { ArrayRef<const char *> getGCCRegNames() const override { return {}; }
return std::nullopt;
}
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override { TargetInfo::ConstraintInfo &info) const override {
@ -175,7 +171,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
BuiltinVaListKind getBuiltinVaListKind() const override { BuiltinVaListKind getBuiltinVaListKind() const override {

View File

@ -50,7 +50,7 @@ public:
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override {
// FIXME: Implement! // FIXME: Implement!
return std::nullopt; return {};
} }
BuiltinVaListKind getBuiltinVaListKind() const override { BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList; return TargetInfo::VoidPtrBuiltinVaList;

View File

@ -105,7 +105,7 @@ public:
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases. // No aliases.
return std::nullopt; return {};
} }
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override; ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;

View File

@ -95,9 +95,7 @@ public:
bool hasFeature(StringRef Feature) const override { return Feature == "tce"; } bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }
ArrayRef<Builtin::Info> getTargetBuiltins() const override { ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
return std::nullopt;
}
std::string_view getClobbers() const override { return ""; } std::string_view getClobbers() const override { return ""; }
@ -105,9 +103,7 @@ public:
return TargetInfo::VoidPtrBuiltinVaList; return TargetInfo::VoidPtrBuiltinVaList;
} }
ArrayRef<const char *> getGCCRegNames() const override { ArrayRef<const char *> getGCCRegNames() const override { return {}; }
return std::nullopt;
}
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override { TargetInfo::ConstraintInfo &info) const override {
@ -115,7 +111,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
}; };

View File

@ -124,10 +124,10 @@ private:
return VoidPtrBuiltinVaList; return VoidPtrBuiltinVaList;
} }
ArrayRef<const char *> getGCCRegNames() const final { return std::nullopt; } ArrayRef<const char *> getGCCRegNames() const final { return {}; }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const final { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const final {
return std::nullopt; return {};
} }
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,

View File

@ -210,7 +210,7 @@ public:
ArrayRef<const char *> getGCCRegNames() const override; ArrayRef<const char *> getGCCRegNames() const override;
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override; ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;

View File

@ -60,7 +60,7 @@ public:
} }
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
return std::nullopt; return {};
} }
bool validateAsmConstraint(const char *&Name, bool validateAsmConstraint(const char *&Name,

View File

@ -2024,7 +2024,7 @@ Value *CodeGenFunction::EmitCheckedArgForBuiltin(const Expr *E,
SanitizerHandler::InvalidBuiltin, SanitizerHandler::InvalidBuiltin,
{EmitCheckSourceLocation(E->getExprLoc()), {EmitCheckSourceLocation(E->getExprLoc()),
llvm::ConstantInt::get(Builder.getInt8Ty(), Kind)}, llvm::ConstantInt::get(Builder.getInt8Ty(), Kind)},
std::nullopt); {});
return ArgValue; return ArgValue;
} }
@ -18530,9 +18530,9 @@ Value *EmitAMDGPUWorkGroupSize(CodeGenFunction &CGF, unsigned Index) {
APInt(16, CGF.getTarget().getMaxOpenCLWorkGroupSize() + 1)); APInt(16, CGF.getTarget().getMaxOpenCLWorkGroupSize() + 1));
LD->setMetadata(llvm::LLVMContext::MD_range, RNode); LD->setMetadata(llvm::LLVMContext::MD_range, RNode);
LD->setMetadata(llvm::LLVMContext::MD_noundef, 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, LD->setMetadata(llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); llvm::MDNode::get(CGF.getLLVMContext(), {}));
return LD; return LD;
} }
@ -18546,7 +18546,7 @@ Value *EmitAMDGPUGridSize(CodeGenFunction &CGF, unsigned Index) {
auto *LD = CGF.Builder.CreateLoad( auto *LD = CGF.Builder.CreateLoad(
Address(GEP, CGF.Int32Ty, CharUnits::fromQuantity(4))); Address(GEP, CGF.Int32Ty, CharUnits::fromQuantity(4)));
LD->setMetadata(llvm::LLVMContext::MD_invariant_load, LD->setMetadata(llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); llvm::MDNode::get(CGF.getLLVMContext(), {}));
return LD; return LD;
} }
} // namespace } // namespace

View File

@ -118,8 +118,8 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> FTNP) {
// When translating an unprototyped function type, always use a // When translating an unprototyped function type, always use a
// variadic type. // variadic type.
return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(), return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(),
FnInfoOpts::None, std::nullopt, FnInfoOpts::None, {}, FTNP->getExtInfo(), {},
FTNP->getExtInfo(), {}, RequiredArgs(0)); RequiredArgs(0));
} }
static void addExtParameterInfosForCall( static void addExtParameterInfosForCall(
@ -473,7 +473,7 @@ CodeGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) {
// non-variadic type. // non-variadic type.
if (CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>()) { if (CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>()) {
return arrangeLLVMFunctionInfo(noProto->getReturnType(), FnInfoOpts::None, return arrangeLLVMFunctionInfo(noProto->getReturnType(), FnInfoOpts::None,
std::nullopt, noProto->getExtInfo(), {}, {}, noProto->getExtInfo(), {},
RequiredArgs::All); RequiredArgs::All);
} }
@ -719,8 +719,8 @@ CodeGenTypes::arrangeCXXMethodCall(const CallArgList &args,
} }
const CGFunctionInfo &CodeGenTypes::arrangeNullaryFunction() { const CGFunctionInfo &CodeGenTypes::arrangeNullaryFunction() {
return arrangeLLVMFunctionInfo(getContext().VoidTy, FnInfoOpts::None, return arrangeLLVMFunctionInfo(getContext().VoidTy, FnInfoOpts::None, {},
std::nullopt, FunctionType::ExtInfo(), {}, FunctionType::ExtInfo(), {},
RequiredArgs::All); RequiredArgs::All);
} }
@ -4423,7 +4423,7 @@ void CodeGenFunction::EmitNonNullArgCheck(RValue RV, QualType ArgType,
EmitCheckSourceLocation(ArgLoc), EmitCheckSourceLocation(AttrLoc), EmitCheckSourceLocation(ArgLoc), EmitCheckSourceLocation(AttrLoc),
llvm::ConstantInt::get(Int32Ty, ArgNo + 1), 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, void CodeGenFunction::EmitNonNullArgCheck(Address Addr, QualType ArgType,
@ -4814,7 +4814,7 @@ CodeGenFunction::EmitNounwindRuntimeCall(llvm::FunctionCallee callee,
/// runtime function. /// runtime function.
llvm::CallInst *CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee callee, llvm::CallInst *CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee callee,
const llvm::Twine &name) { 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 // Calls which may throw must have operand bundles indicating which funclet
@ -4881,7 +4881,7 @@ void CodeGenFunction::EmitNoreturnRuntimeCallOrInvoke(
llvm::CallBase * llvm::CallBase *
CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee,
const Twine &name) { const Twine &name) {
return EmitRuntimeCallOrInvoke(callee, std::nullopt, name); return EmitRuntimeCallOrInvoke(callee, {}, name);
} }
/// Emits a call or invoke instruction to the given runtime function. /// Emits a call or invoke instruction to the given runtime function.

View File

@ -1329,8 +1329,7 @@ static void EmitSehScope(CodeGenFunction &CGF,
CGF.getBundlesForFunclet(SehCppScope.getCallee()); CGF.getBundlesForFunclet(SehCppScope.getCallee());
if (CGF.CurrentFuncletPad) if (CGF.CurrentFuncletPad)
BundleList.emplace_back("funclet", CGF.CurrentFuncletPad); BundleList.emplace_back("funclet", CGF.CurrentFuncletPad);
CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, std::nullopt, CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, {}, BundleList);
BundleList);
CGF.EmitBlock(Cont); CGF.EmitBlock(Cont);
} }

View File

@ -2642,7 +2642,7 @@ void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
return; return;
llvm::MDNode *node; llvm::MDNode *node;
if (AllocatedTy->isVoidType()) if (AllocatedTy->isVoidType())
node = llvm::MDNode::get(CGM.getLLVMContext(), std::nullopt); node = llvm::MDNode::get(CGM.getLLVMContext(), {});
else else
node = getOrCreateType(AllocatedTy, getOrCreateFile(Loc)); node = getOrCreateType(AllocatedTy, getOrCreateFile(Loc));
@ -4324,8 +4324,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
!CGM.getCodeGenOpts().EmitCodeView)) !CGM.getCodeGenOpts().EmitCodeView))
// Create fake but valid subroutine type. Otherwise -verify would fail, and // 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. // subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields.
return DBuilder.createSubroutineType( return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray({}));
DBuilder.getOrCreateTypeArray(std::nullopt));
if (const auto *Method = dyn_cast<CXXMethodDecl>(D)) if (const auto *Method = dyn_cast<CXXMethodDecl>(D))
return getOrCreateMethodType(Method, F); return getOrCreateMethodType(Method, F);

View File

@ -2042,7 +2042,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) { if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) {
Load->setMetadata(llvm::LLVMContext::MD_range, RangeInfo); Load->setMetadata(llvm::LLVMContext::MD_range, RangeInfo);
Load->setMetadata(llvm::LLVMContext::MD_noundef, Load->setMetadata(llvm::LLVMContext::MD_noundef,
llvm::MDNode::get(getLLVMContext(), std::nullopt)); llvm::MDNode::get(getLLVMContext(), {}));
} }
return EmitFromMemory(Load, Ty); 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 // Format the type name as if for a diagnostic, including quotes and
// optionally an 'aka'. // optionally an 'aka'.
SmallString<32> Buffer; SmallString<32> Buffer;
CGM.getDiags().ConvertArgToString( CGM.getDiags().ConvertArgToString(DiagnosticsEngine::ak_qualtype,
DiagnosticsEngine::ak_qualtype, (intptr_t)T.getAsOpaquePtr(), StringRef(), (intptr_t)T.getAsOpaquePtr(), StringRef(),
StringRef(), std::nullopt, Buffer, std::nullopt); StringRef(), {}, Buffer, {});
if (IsBitInt) { if (IsBitInt) {
// The Structure is: 0 to end the string, 32 bit unsigned integer in target // 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<llvm::Value *>(Builder.getFalse()), EmitCheck(std::make_pair(static_cast<llvm::Value *>(Builder.getFalse()),
SanitizerKind::Unreachable), SanitizerKind::Unreachable),
SanitizerHandler::BuiltinUnreachable, SanitizerHandler::BuiltinUnreachable,
EmitCheckSourceLocation(Loc), std::nullopt); EmitCheckSourceLocation(Loc), {});
} }
Builder.CreateUnreachable(); Builder.CreateUnreachable();
} }

View File

@ -506,7 +506,7 @@ LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs,
Attrs.CodeAlign == 0 && !StartLoc && !EndLoc && !Attrs.MustProgress) Attrs.CodeAlign == 0 && !StartLoc && !EndLoc && !Attrs.MustProgress)
return; return;
TempLoopID = MDNode::getTemporary(Header->getContext(), std::nullopt); TempLoopID = MDNode::getTemporary(Header->getContext(), {});
} }
void LoopInfo::finish() { void LoopInfo::finish() {

View File

@ -140,7 +140,7 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc()); llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc());
cast<llvm::LoadInst>(Ptr)->setMetadata( cast<llvm::LoadInst>(Ptr)->setMetadata(
llvm::LLVMContext::MD_invariant_load, llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(getLLVMContext(), std::nullopt)); llvm::MDNode::get(getLLVMContext(), {}));
return Builder.CreateBitCast(Ptr, ConvertType(E->getType())); return Builder.CreateBitCast(Ptr, ConvertType(E->getType()));
} }
@ -2319,7 +2319,7 @@ llvm::Value *CodeGenFunction::EmitARCRetainBlock(llvm::Value *value,
CGM.getObjCEntrypoints().objc_retainBlock); CGM.getObjCEntrypoints().objc_retainBlock);
call->setMetadata("clang.arc.copy_on_escape", call->setMetadata("clang.arc.copy_on_escape",
llvm::MDNode::get(Builder.getContext(), std::nullopt)); llvm::MDNode::get(Builder.getContext(), {}));
} }
return result; 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. // Call the marker asm if we made one, which we do only at -O0.
if (marker) if (marker)
CGF.Builder.CreateCall(marker, std::nullopt, CGF.Builder.CreateCall(marker, {}, CGF.getBundlesForFunclet(marker));
CGF.getBundlesForFunclet(marker));
} }
static llvm::Value *emitOptimizedARCReturnCall(llvm::Value *value, static llvm::Value *emitOptimizedARCReturnCall(llvm::Value *value,
@ -2449,7 +2448,7 @@ void CodeGenFunction::EmitARCRelease(llvm::Value *value,
if (precise == ARCImpreciseLifetime) { if (precise == ARCImpreciseLifetime) {
call->setMetadata("clang.imprecise_release", 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) { if (precise == ARCImpreciseLifetime) {
call->setMetadata("clang.imprecise_release", call->setMetadata("clang.imprecise_release",
llvm::MDNode::get(Builder.getContext(), std::nullopt)); llvm::MDNode::get(Builder.getContext(), {}));
} }
} }

View File

@ -69,7 +69,7 @@ public:
FTy = llvm::FunctionType::get(RetTy, ArgTys, false); FTy = llvm::FunctionType::get(RetTy, ArgTys, false);
} }
else { else {
FTy = llvm::FunctionType::get(RetTy, std::nullopt, false); FTy = llvm::FunctionType::get(RetTy, {}, false);
} }
} }

View File

@ -7191,7 +7191,7 @@ CGObjCNonFragileABIMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
if (IsIvarOffsetKnownIdempotent(CGF, Ivar)) if (IsIvarOffsetKnownIdempotent(CGF, Ivar))
cast<llvm::LoadInst>(IvarOffsetValue) cast<llvm::LoadInst>(IvarOffsetValue)
->setMetadata(llvm::LLVMContext::MD_invariant_load, ->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. // 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); llvm::LoadInst* LI = CGF.Builder.CreateLoad(Addr);
LI->setMetadata(llvm::LLVMContext::MD_invariant_load, LI->setMetadata(llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(VMContext, std::nullopt)); llvm::MDNode::get(VMContext, {}));
return LI; return LI;
} }

View File

@ -5075,7 +5075,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
}; };
RegionCodeGenTy RCG(CodeGen); RegionCodeGenTy RCG(CodeGen);
CommonActionTy Action( CommonActionTy Action(
nullptr, std::nullopt, nullptr, {},
OMPBuilder.getOrCreateRuntimeFunction( OMPBuilder.getOrCreateRuntimeFunction(
CGM.getModule(), WithNowait ? OMPRTL___kmpc_end_reduce_nowait CGM.getModule(), WithNowait ? OMPRTL___kmpc_end_reduce_nowait
: OMPRTL___kmpc_end_reduce), : OMPRTL___kmpc_end_reduce),
@ -5197,7 +5197,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
ThreadId, // i32 <gtid> ThreadId, // i32 <gtid>
Lock // kmp_critical_name *&<lock> Lock // kmp_critical_name *&<lock>
}; };
CommonActionTy Action(nullptr, std::nullopt, CommonActionTy Action(nullptr, {},
OMPBuilder.getOrCreateRuntimeFunction( OMPBuilder.getOrCreateRuntimeFunction(
CGM.getModule(), OMPRTL___kmpc_end_reduce), CGM.getModule(), OMPRTL___kmpc_end_reduce),
EndArgs); EndArgs);
@ -6819,7 +6819,7 @@ private:
const ValueDecl *Mapper = nullptr, bool ForDeviceAddr = false, const ValueDecl *Mapper = nullptr, bool ForDeviceAddr = false,
const ValueDecl *BaseDecl = nullptr, const Expr *MapExpr = nullptr, const ValueDecl *BaseDecl = nullptr, const Expr *MapExpr = nullptr,
ArrayRef<OMPClauseMappableExprCommon::MappableExprComponentListRef> ArrayRef<OMPClauseMappableExprCommon::MappableExprComponentListRef>
OverlappedElements = std::nullopt, OverlappedElements = {},
bool AreBothBasePtrAndPteeMapped = false) const { bool AreBothBasePtrAndPteeMapped = false) const {
// The following summarizes what has to be generated for each map and the // The following summarizes what has to be generated for each map and the
// types below. The generated information is expressed in this order: // types below. The generated information is expressed in this order:
@ -7693,7 +7693,7 @@ private:
// for map(to: lambda): using user specified map type. // for map(to: lambda): using user specified map type.
return getMapTypeBits( return getMapTypeBits(
I->getSecond()->getMapType(), I->getSecond()->getMapTypeModifiers(), I->getSecond()->getMapType(), I->getSecond()->getMapTypeModifiers(),
/*MotionModifiers=*/std::nullopt, I->getSecond()->isImplicit(), /*MotionModifiers=*/{}, I->getSecond()->isImplicit(),
/*AddPtrFlag=*/false, /*AddPtrFlag=*/false,
/*AddIsTargetParamFlag=*/false, /*AddIsTargetParamFlag=*/false,
/*isNonContiguous=*/false); /*isNonContiguous=*/false);
@ -7818,7 +7818,7 @@ private:
for (const auto L : C->component_lists()) { for (const auto L : C->component_lists()) {
const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr; const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr;
InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(), 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), /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L),
E); E);
++EI; ++EI;
@ -7834,7 +7834,7 @@ private:
Kind = Present; Kind = Present;
const auto *EI = C->getVarRefs().begin(); const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) { 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->getMotionModifiers(), /*ReturnDevicePointer=*/false,
C->isImplicit(), std::get<2>(L), *EI); C->isImplicit(), std::get<2>(L), *EI);
++EI; ++EI;
@ -7850,8 +7850,8 @@ private:
Kind = Present; Kind = Present;
const auto *EI = C->getVarRefs().begin(); const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) { for (const auto L : C->component_lists()) {
InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, {},
std::nullopt, C->getMotionModifiers(), C->getMotionModifiers(),
/*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L), /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L),
*EI); *EI);
++EI; ++EI;
@ -7903,9 +7903,9 @@ private:
// processed. Nonetheless, generateInfoForComponentList must be // processed. Nonetheless, generateInfoForComponentList must be
// called to take the pointer into account for the calculation of // called to take the pointer into account for the calculation of
// the range of the partial struct. // the range of the partial struct.
InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, std::nullopt, InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, {}, {},
std::nullopt, /*ReturnDevicePointer=*/false, IsImplicit, /*ReturnDevicePointer=*/false, IsImplicit, nullptr, nullptr,
nullptr, nullptr, IsDevAddr); IsDevAddr);
DeferredInfo[nullptr].emplace_back(IE, VD, IsDevAddr); DeferredInfo[nullptr].emplace_back(IE, VD, IsDevAddr);
} else { } else {
llvm::Value *Ptr; llvm::Value *Ptr;
@ -8056,7 +8056,7 @@ private:
CurInfo, StructBaseCurInfo, PartialStruct, CurInfo, StructBaseCurInfo, PartialStruct,
/*IsFirstComponentList=*/false, L.IsImplicit, /*IsFirstComponentList=*/false, L.IsImplicit,
/*GenerateAllInfoForClauses*/ true, L.Mapper, L.ForDeviceAddr, VD, /*GenerateAllInfoForClauses*/ true, L.Mapper, L.ForDeviceAddr, VD,
L.VarRef, /*OverlappedElements*/ std::nullopt, L.VarRef, /*OverlappedElements*/ {},
HasMapBasePtr && HasMapArraySec); HasMapBasePtr && HasMapArraySec);
// If this entry relates to a device pointer, set the relevant // If this entry relates to a device pointer, set the relevant
@ -8692,7 +8692,7 @@ public:
ArrayRef<OMPClauseMappableExprCommon::MappableExprComponentListRef> ArrayRef<OMPClauseMappableExprCommon::MappableExprComponentListRef>
OverlappedComponents = Pair.getSecond(); OverlappedComponents = Pair.getSecond();
generateInfoForComponentList( generateInfoForComponentList(
MapType, MapModifiers, std::nullopt, Components, CombinedInfo, MapType, MapModifiers, {}, Components, CombinedInfo,
StructBaseCombinedInfo, PartialStruct, IsFirstComponentList, StructBaseCombinedInfo, PartialStruct, IsFirstComponentList,
IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper, IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper,
/*ForDeviceAddr=*/false, VD, VarRef, OverlappedComponents); /*ForDeviceAddr=*/false, VD, VarRef, OverlappedComponents);
@ -8711,12 +8711,11 @@ public:
auto It = OverlappedData.find(&L); auto It = OverlappedData.find(&L);
if (It == OverlappedData.end()) if (It == OverlappedData.end())
generateInfoForComponentList( generateInfoForComponentList(
MapType, MapModifiers, std::nullopt, Components, CombinedInfo, MapType, MapModifiers, {}, Components, CombinedInfo,
StructBaseCombinedInfo, PartialStruct, IsFirstComponentList, StructBaseCombinedInfo, PartialStruct, IsFirstComponentList,
IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper, IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper,
/*ForDeviceAddr=*/false, VD, VarRef, /*ForDeviceAddr=*/false, VD, VarRef,
/*OverlappedElements*/ std::nullopt, /*OverlappedElements*/ {}, HasMapBasePtr && HasMapArraySec);
HasMapBasePtr && HasMapArraySec);
IsFirstComponentList = false; IsFirstComponentList = false;
} }
} }

View File

@ -352,7 +352,7 @@ protected:
/// Emits \p Callee function call with arguments \p Args with location \p Loc. /// Emits \p Callee function call with arguments \p Args with location \p Loc.
void emitCall(CodeGenFunction &CGF, SourceLocation Loc, void emitCall(CodeGenFunction &CGF, SourceLocation Loc,
llvm::FunctionCallee Callee, llvm::FunctionCallee Callee,
ArrayRef<llvm::Value *> Args = std::nullopt) const; ArrayRef<llvm::Value *> Args = {}) const;
/// Emits address of the word in a memory where current thread id is /// Emits address of the word in a memory where current thread id is
/// stored. /// stored.
@ -1543,7 +1543,7 @@ public:
virtual void virtual void
emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc, emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc,
llvm::FunctionCallee OutlinedFn, llvm::FunctionCallee OutlinedFn,
ArrayRef<llvm::Value *> Args = std::nullopt) const; ArrayRef<llvm::Value *> Args = {}) const;
/// Emits OpenMP-specific function prolog. /// Emits OpenMP-specific function prolog.
/// Required for device constructs. /// Required for device constructs.

View File

@ -985,8 +985,8 @@ llvm::Function *CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(
getDistributeLastprivateVars(CGM.getContext(), D, LastPrivatesReductions); getDistributeLastprivateVars(CGM.getContext(), D, LastPrivatesReductions);
if (!LastPrivatesReductions.empty()) { if (!LastPrivatesReductions.empty()) {
GlobalizedRD = ::buildRecordForGlobalizedVars( GlobalizedRD = ::buildRecordForGlobalizedVars(
CGM.getContext(), std::nullopt, LastPrivatesReductions, CGM.getContext(), {}, LastPrivatesReductions, MappedDeclsFields,
MappedDeclsFields, WarpSize); WarpSize);
} }
} else if (!LastPrivatesReductions.empty()) { } else if (!LastPrivatesReductions.empty()) {
assert(!TeamAndReductions.first && assert(!TeamAndReductions.first &&
@ -1681,7 +1681,7 @@ void CGOpenMPRuntimeGPU::emitReduction(
++Cnt; ++Cnt;
} }
const RecordDecl *ReductionRec = ::buildRecordForGlobalizedVars( const RecordDecl *ReductionRec = ::buildRecordForGlobalizedVars(
CGM.getContext(), PrivatesReductions, std::nullopt, VarFieldMap, 1); CGM.getContext(), PrivatesReductions, {}, VarFieldMap, 1);
if (TeamsReduction) if (TeamsReduction)
TeamsReductions.push_back(ReductionRec); TeamsReductions.push_back(ReductionRec);
@ -2345,11 +2345,11 @@ llvm::Value *CGOpenMPRuntimeGPU::getGPUNumThreads(CodeGenFunction &CGF) {
const char *LocSize = "__kmpc_get_hardware_num_threads_in_block"; const char *LocSize = "__kmpc_get_hardware_num_threads_in_block";
llvm::Function *F = M->getFunction(LocSize); llvm::Function *F = M->getFunction(LocSize);
if (!F) { if (!F) {
F = llvm::Function::Create( F = llvm::Function::Create(llvm::FunctionType::get(CGF.Int32Ty, {}, false),
llvm::FunctionType::get(CGF.Int32Ty, std::nullopt, false), llvm::GlobalVariable::ExternalLinkage, LocSize,
llvm::GlobalVariable::ExternalLinkage, LocSize, &CGF.CGM.getModule()); &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) { llvm::Value *CGOpenMPRuntimeGPU::getGPUThreadID(CodeGenFunction &CGF) {

View File

@ -294,9 +294,10 @@ public:
/// Emits call of the outlined function with the provided arguments, /// Emits call of the outlined function with the provided arguments,
/// translating these arguments to correct target-specific arguments. /// translating these arguments to correct target-specific arguments.
void emitOutlinedFunctionCall( void
CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc,
ArrayRef<llvm::Value *> Args = std::nullopt) const override; llvm::FunctionCallee OutlinedFn,
ArrayRef<llvm::Value *> Args = {}) const override;
/// Emits OpenMP-specific function prolog. /// Emits OpenMP-specific function prolog.
/// Required for device constructs. /// Required for device constructs.

View File

@ -501,7 +501,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
FunctionDecl *DebugFunctionDecl = nullptr; FunctionDecl *DebugFunctionDecl = nullptr;
if (!FO.UIntPtrCastRequired) { if (!FO.UIntPtrCastRequired) {
FunctionProtoType::ExtProtoInfo EPI; FunctionProtoType::ExtProtoInfo EPI;
QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, std::nullopt, EPI); QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, {}, EPI);
DebugFunctionDecl = FunctionDecl::Create( DebugFunctionDecl = FunctionDecl::Create(
Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(), Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(),
SourceLocation(), DeclarationName(), FunctionTy, SourceLocation(), DeclarationName(), FunctionTy,
@ -5509,7 +5509,7 @@ void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) {
if (const auto *FlushClause = S.getSingleClause<OMPFlushClause>()) if (const auto *FlushClause = S.getSingleClause<OMPFlushClause>())
return llvm::ArrayRef(FlushClause->varlist_begin(), return llvm::ArrayRef(FlushClause->varlist_begin(),
FlushClause->varlist_end()); FlushClause->varlist_end());
return std::nullopt; return {};
}(), }(),
S.getBeginLoc(), AO); S.getBeginLoc(), AO);
} }
@ -6199,7 +6199,7 @@ static void emitOMPAtomicReadExpr(CodeGenFunction &CGF, llvm::AtomicOrdering AO,
case llvm::AtomicOrdering::Acquire: case llvm::AtomicOrdering::Acquire:
case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::AcquireRelease:
case llvm::AtomicOrdering::SequentiallyConsistent: case llvm::AtomicOrdering::SequentiallyConsistent:
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc,
llvm::AtomicOrdering::Acquire); llvm::AtomicOrdering::Acquire);
break; break;
case llvm::AtomicOrdering::Monotonic: case llvm::AtomicOrdering::Monotonic:
@ -6228,7 +6228,7 @@ static void emitOMPAtomicWriteExpr(CodeGenFunction &CGF,
case llvm::AtomicOrdering::Release: case llvm::AtomicOrdering::Release:
case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::AcquireRelease:
case llvm::AtomicOrdering::SequentiallyConsistent: case llvm::AtomicOrdering::SequentiallyConsistent:
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc,
llvm::AtomicOrdering::Release); llvm::AtomicOrdering::Release);
break; break;
case llvm::AtomicOrdering::Acquire: case llvm::AtomicOrdering::Acquire:
@ -6418,7 +6418,7 @@ static void emitOMPAtomicUpdateExpr(CodeGenFunction &CGF,
case llvm::AtomicOrdering::Release: case llvm::AtomicOrdering::Release:
case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::AcquireRelease:
case llvm::AtomicOrdering::SequentiallyConsistent: case llvm::AtomicOrdering::SequentiallyConsistent:
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc,
llvm::AtomicOrdering::Release); llvm::AtomicOrdering::Release);
break; break;
case llvm::AtomicOrdering::Acquire: case llvm::AtomicOrdering::Acquire:
@ -6533,17 +6533,17 @@ static void emitOMPAtomicCaptureExpr(CodeGenFunction &CGF,
// operation is also an acquire flush. // operation is also an acquire flush.
switch (AO) { switch (AO) {
case llvm::AtomicOrdering::Release: case llvm::AtomicOrdering::Release:
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc,
llvm::AtomicOrdering::Release); llvm::AtomicOrdering::Release);
break; break;
case llvm::AtomicOrdering::Acquire: case llvm::AtomicOrdering::Acquire:
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, std::nullopt, Loc, CGF.CGM.getOpenMPRuntime().emitFlush(CGF, {}, Loc,
llvm::AtomicOrdering::Acquire); llvm::AtomicOrdering::Acquire);
break; break;
case llvm::AtomicOrdering::AcquireRelease: case llvm::AtomicOrdering::AcquireRelease:
case llvm::AtomicOrdering::SequentiallyConsistent: case llvm::AtomicOrdering::SequentiallyConsistent:
CGF.CGM.getOpenMPRuntime().emitFlush( CGF.CGM.getOpenMPRuntime().emitFlush(
CGF, std::nullopt, Loc, llvm::AtomicOrdering::AcquireRelease); CGF, {}, Loc, llvm::AtomicOrdering::AcquireRelease);
break; break;
case llvm::AtomicOrdering::Monotonic: case llvm::AtomicOrdering::Monotonic:
break; break;

View File

@ -1595,7 +1595,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
llvm::Value *IsFalse = Builder.getFalse(); llvm::Value *IsFalse = Builder.getFalse();
EmitCheck(std::make_pair(IsFalse, SanitizerKind::Return), EmitCheck(std::make_pair(IsFalse, SanitizerKind::Return),
SanitizerHandler::MissingReturn, SanitizerHandler::MissingReturn,
EmitCheckSourceLocation(FD->getLocation()), std::nullopt); EmitCheckSourceLocation(FD->getLocation()), {});
} else if (ShouldEmitUnreachable) { } else if (ShouldEmitUnreachable) {
if (CGM.getCodeGenOpts().OptimizationLevel == 0) if (CGM.getCodeGenOpts().OptimizationLevel == 0)
EmitTrapCall(llvm::Intrinsic::trap); EmitTrapCall(llvm::Intrinsic::trap);

View File

@ -3524,7 +3524,7 @@ public:
/// This function may clear the current insertion point; callers should use /// This function may clear the current insertion point; callers should use
/// EnsureInsertPoint if they wish to subsequently generate code without first /// EnsureInsertPoint if they wish to subsequently generate code without first
/// calling EmitBlock, EmitBranch, or EmitStmt. /// calling EmitBlock, EmitBranch, or EmitStmt.
void EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs = std::nullopt); void EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs = {});
/// EmitSimpleStmt - Try to emit a "simple" statement which does not /// EmitSimpleStmt - Try to emit a "simple" statement which does not
/// necessarily require an insertion point or debug information; typically /// necessarily require an insertion point or debug information; typically
@ -3551,11 +3551,9 @@ public:
void EmitIndirectGotoStmt(const IndirectGotoStmt &S); void EmitIndirectGotoStmt(const IndirectGotoStmt &S);
void EmitIfStmt(const IfStmt &S); void EmitIfStmt(const IfStmt &S);
void EmitWhileStmt(const WhileStmt &S, void EmitWhileStmt(const WhileStmt &S, ArrayRef<const Attr *> Attrs = {});
ArrayRef<const Attr *> Attrs = std::nullopt); void EmitDoStmt(const DoStmt &S, ArrayRef<const Attr *> Attrs = {});
void EmitDoStmt(const DoStmt &S, ArrayRef<const Attr *> Attrs = std::nullopt); void EmitForStmt(const ForStmt &S, ArrayRef<const Attr *> Attrs = {});
void EmitForStmt(const ForStmt &S,
ArrayRef<const Attr *> Attrs = std::nullopt);
void EmitReturnStmt(const ReturnStmt &S); void EmitReturnStmt(const ReturnStmt &S);
void EmitDeclStmt(const DeclStmt &S); void EmitDeclStmt(const DeclStmt &S);
void EmitBreakStmt(const BreakStmt &S); void EmitBreakStmt(const BreakStmt &S);
@ -3632,7 +3630,7 @@ public:
llvm::Value *ParentFP); llvm::Value *ParentFP);
void EmitCXXForRangeStmt(const CXXForRangeStmt &S, void EmitCXXForRangeStmt(const CXXForRangeStmt &S,
ArrayRef<const Attr *> Attrs = std::nullopt); ArrayRef<const Attr *> Attrs = {});
/// Controls insertion of cancellation exit blocks in worksharing constructs. /// Controls insertion of cancellation exit blocks in worksharing constructs.
class OMPCancelStackRAII { class OMPCancelStackRAII {

View File

@ -753,8 +753,7 @@ public:
llvm::MDNode *getNoObjCARCExceptionsMetadata() { llvm::MDNode *getNoObjCARCExceptionsMetadata() {
if (!NoObjCARCExceptionsMetadata) if (!NoObjCARCExceptionsMetadata)
NoObjCARCExceptionsMetadata = NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), {});
llvm::MDNode::get(getLLVMContext(), std::nullopt);
return NoObjCARCExceptionsMetadata; return NoObjCARCExceptionsMetadata;
} }
@ -1181,8 +1180,7 @@ public:
llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD, llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD,
unsigned BuiltinID); unsigned BuiltinID);
llvm::Function *getIntrinsic(unsigned IID, llvm::Function *getIntrinsic(unsigned IID, ArrayRef<llvm::Type *> Tys = {});
ArrayRef<llvm::Type *> Tys = std::nullopt);
/// Emit code for a single top level declaration. /// Emit code for a single top level declaration.
void EmitTopLevelDecl(Decl *D); void EmitTopLevelDecl(Decl *D);

View File

@ -649,7 +649,7 @@ struct EmptyCoverageMappingBuilder : public CoverageMappingBuilder {
if (MappingRegions.empty()) if (MappingRegions.empty())
return; return;
CoverageMappingWriter Writer(FileIDMapping, std::nullopt, MappingRegions); CoverageMappingWriter Writer(FileIDMapping, {}, MappingRegions);
Writer.write(OS); Writer.write(OS);
} }
}; };

View File

@ -1416,7 +1416,7 @@ void ItaniumCXXABI::emitRethrow(CodeGenFunction &CGF, bool isNoReturn) {
llvm::FunctionCallee Fn = CGM.CreateRuntimeFunction(FTy, "__cxa_rethrow"); llvm::FunctionCallee Fn = CGM.CreateRuntimeFunction(FTy, "__cxa_rethrow");
if (isNoReturn) if (isNoReturn)
CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, std::nullopt); CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, {});
else else
CGF.EmitRuntimeCallOrInvoke(Fn); CGF.EmitRuntimeCallOrInvoke(Fn);
} }

View File

@ -146,7 +146,7 @@ void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) {
void DiagnosticRenderer::emitBasicNote(StringRef Message) { void DiagnosticRenderer::emitBasicNote(StringRef Message) {
emitDiagnosticMessage(FullSourceLoc(), PresumedLoc(), DiagnosticsEngine::Note, emitDiagnosticMessage(FullSourceLoc(), PresumedLoc(), DiagnosticsEngine::Note,
Message, std::nullopt, DiagOrStoredDiag()); Message, {}, DiagOrStoredDiag());
} }
/// Prints an include stack when appropriate for a particular /// Prints an include stack when appropriate for a particular
@ -451,7 +451,7 @@ void DiagnosticRenderer::emitSingleMacroExpansion(
Message << "expanded from macro '" << MacroName << "'"; Message << "expanded from macro '" << MacroName << "'";
emitDiagnostic(SpellingLoc, DiagnosticsEngine::Note, Message.str(), emitDiagnostic(SpellingLoc, DiagnosticsEngine::Note, Message.str(),
SpellingRanges, std::nullopt); SpellingRanges, {});
} }
/// Check that the macro argument location of Loc starts with ArgumentLoc. /// Check that the macro argument location of Loc starts with ArgumentLoc.

View File

@ -68,17 +68,17 @@ public:
static bool isTemplateImplicitInstantiation(const Decl *D); static bool isTemplateImplicitInstantiation(const Decl *D);
bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(), bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = std::nullopt); ArrayRef<SymbolRelation> Relations = {});
bool handleDecl(const Decl *D, SourceLocation Loc, bool handleDecl(const Decl *D, SourceLocation Loc,
SymbolRoleSet Roles = SymbolRoleSet(), SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = std::nullopt, ArrayRef<SymbolRelation> Relations = {},
const DeclContext *DC = nullptr); const DeclContext *DC = nullptr);
bool handleReference(const NamedDecl *D, SourceLocation Loc, bool handleReference(const NamedDecl *D, SourceLocation Loc,
const NamedDecl *Parent, const DeclContext *DC, const NamedDecl *Parent, const DeclContext *DC,
SymbolRoleSet Roles = SymbolRoleSet(), SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = std::nullopt, ArrayRef<SymbolRelation> Relations = {},
const Expr *RefE = nullptr); const Expr *RefE = nullptr);
void handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc, void handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc,
@ -94,8 +94,7 @@ public:
bool indexDecl(const Decl *D); bool indexDecl(const Decl *D);
void indexTagDecl(const TagDecl *D, void indexTagDecl(const TagDecl *D, ArrayRef<SymbolRelation> Relations = {});
ArrayRef<SymbolRelation> Relations = std::nullopt);
void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent, void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent,
const DeclContext *DC = nullptr, const DeclContext *DC = nullptr,

View File

@ -707,7 +707,7 @@ ModuleMap::findAllModulesForHeader(FileEntryRef File) {
if (findOrCreateModuleForHeaderInUmbrellaDir(File)) if (findOrCreateModuleForHeaderInUmbrellaDir(File))
return Headers.find(File)->second; return Headers.find(File)->second;
return std::nullopt; return {};
} }
ArrayRef<ModuleMap::KnownHeader> ArrayRef<ModuleMap::KnownHeader>
@ -716,7 +716,7 @@ ModuleMap::findResolvedModulesForHeader(FileEntryRef File) const {
resolveHeaderDirectives(File); resolveHeaderDirectives(File);
auto It = Headers.find(File); auto It = Headers.find(File);
if (It == Headers.end()) if (It == Headers.end())
return std::nullopt; return {};
return It->second; return It->second;
} }

View File

@ -286,8 +286,8 @@ void Preprocessor::dumpMacroInfo(const IdentifierInfo *II) {
// Dump module macros. // Dump module macros.
llvm::DenseSet<ModuleMacro*> Active; llvm::DenseSet<ModuleMacro*> Active;
for (auto *MM : for (auto *MM : State ? State->getActiveModuleMacros(*this, II)
State ? State->getActiveModuleMacros(*this, II) : std::nullopt) : ArrayRef<ModuleMacro *>())
Active.insert(MM); Active.insert(MM);
llvm::DenseSet<ModuleMacro*> Visited; llvm::DenseSet<ModuleMacro*> Visited;
llvm::SmallVector<ModuleMacro *, 16> Worklist(Leaf); llvm::SmallVector<ModuleMacro *, 16> Worklist(Leaf);

View File

@ -2445,8 +2445,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
// Recover as if it were an explicit specialization. // Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists; TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList( FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
std::nullopt, LAngleLoc, nullptr)); LAngleLoc, nullptr));
TheDecl = ParseFunctionDefinition( TheDecl = ParseFunctionDefinition(
D, D,
@ -2787,8 +2787,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
// Recover as if it were an explicit specialization. // Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists; TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList( FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
std::nullopt, LAngleLoc, nullptr)); LAngleLoc, nullptr));
ThisDecl = ThisDecl =
Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D); Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D);

View File

@ -2220,8 +2220,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// "template<>", so that we treat this construct as a class // "template<>", so that we treat this construct as a class
// template specialization. // template specialization.
FakedParamLists.push_back(Actions.ActOnTemplateParameterList( FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
std::nullopt, LAngleLoc, nullptr)); LAngleLoc, nullptr));
TemplateParams = &FakedParamLists; TemplateParams = &FakedParamLists;
} }
} }

View File

@ -3855,8 +3855,8 @@ ExprResult Parser::ParseBlockLiteralExpression() {
/*NumExceptions=*/0, /*NumExceptions=*/0,
/*NoexceptExpr=*/nullptr, /*NoexceptExpr=*/nullptr,
/*ExceptionSpecTokens=*/nullptr, /*ExceptionSpecTokens=*/nullptr,
/*DeclsInPrototype=*/std::nullopt, /*DeclsInPrototype=*/{}, CaretLoc,
CaretLoc, CaretLoc, ParamInfo), CaretLoc, ParamInfo),
CaretLoc); CaretLoc);
MaybeParseGNUAttributes(ParamInfo); MaybeParseGNUAttributes(ParamInfo);

View File

@ -1579,9 +1579,8 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
DynamicExceptionRanges.data(), DynamicExceptions.size(), DynamicExceptionRanges.data(), DynamicExceptions.size(),
NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr, NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr,
/*ExceptionSpecTokens*/ nullptr, /*ExceptionSpecTokens*/ nullptr,
/*DeclsInPrototype=*/std::nullopt, LParenLoc, /*DeclsInPrototype=*/{}, LParenLoc, FunLocalRangeEnd, D,
FunLocalRangeEnd, D, TrailingReturnType, TrailingReturnType, TrailingReturnTypeLoc, &DS),
TrailingReturnTypeLoc, &DS),
std::move(Attributes), DeclEndLoc); std::move(Attributes), DeclEndLoc);
// We have called ActOnLambdaClosureQualifiers for parentheses-less cases // We have called ActOnLambdaClosureQualifiers for parentheses-less cases

View File

@ -487,7 +487,7 @@ ExprResult Parser::ParseBraceInitializer() {
: diag::ext_c_empty_initializer); : diag::ext_c_empty_initializer);
} }
// Match the '}'. // Match the '}'.
return Actions.ActOnInitList(LBraceLoc, std::nullopt, ConsumeBrace()); return Actions.ActOnInitList(LBraceLoc, {}, ConsumeBrace());
} }
// Enter an appropriate expression evaluation context for an initializer list. // Enter an appropriate expression evaluation context for an initializer list.

View File

@ -3227,13 +3227,13 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
cutOffParsing(); cutOffParsing();
if (SuperLoc.isValid()) if (SuperLoc.isValid())
Actions.CodeCompletion().CodeCompleteObjCSuperMessage( Actions.CodeCompletion().CodeCompleteObjCSuperMessage(
getCurScope(), SuperLoc, std::nullopt, false); getCurScope(), SuperLoc, {}, false);
else if (ReceiverType) else if (ReceiverType)
Actions.CodeCompletion().CodeCompleteObjCClassMessage( Actions.CodeCompletion().CodeCompleteObjCClassMessage(
getCurScope(), ReceiverType, std::nullopt, false); getCurScope(), ReceiverType, {}, false);
else else
Actions.CodeCompletion().CodeCompleteObjCInstanceMessage( Actions.CodeCompletion().CodeCompleteObjCInstanceMessage(
getCurScope(), ReceiverExpr, std::nullopt, false); getCurScope(), ReceiverExpr, {}, false);
return ExprError(); return ExprError();
} }

View File

@ -2561,7 +2561,7 @@ StmtResult Parser::ParseOpenMPExecutableDirective(
DKind == OMPD_target_exit_data) { DKind == OMPD_target_exit_data) {
Actions.OpenMP().ActOnOpenMPRegionStart(DKind, getCurScope()); Actions.OpenMP().ActOnOpenMPRegionStart(DKind, getCurScope());
AssociatedStmt = (Sema::CompoundScopeRAII(Actions), AssociatedStmt = (Sema::CompoundScopeRAII(Actions),
Actions.ActOnCompoundStmt(Loc, Loc, std::nullopt, Actions.ActOnCompoundStmt(Loc, Loc, {},
/*isStmtExpr=*/false)); /*isStmtExpr=*/false));
AssociatedStmt = AssociatedStmt =
Actions.OpenMP().ActOnOpenMPRegionEnd(AssociatedStmt, Clauses); Actions.OpenMP().ActOnOpenMPRegionEnd(AssociatedStmt, Clauses);

View File

@ -2558,8 +2558,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
// If the function body could not be parsed, make a bogus compoundstmt. // If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid()) { if (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions); Sema::CompoundScopeRAII CompoundScope(Actions);
FnBody = FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
} }
BodyScope.Exit(); BodyScope.Exit();
@ -2596,8 +2595,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
// compound statement as the body. // compound statement as the body.
if (FnBody.isInvalid()) { if (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions); Sema::CompoundScopeRAII CompoundScope(Actions);
FnBody = FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
} }
BodyScope.Exit(); BodyScope.Exit();

View File

@ -2536,8 +2536,8 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
// with default arguments, etc. // with default arguments, etc.
if (IsMemExpr && !E.isTypeDependent()) { if (IsMemExpr && !E.isTypeDependent()) {
Sema::TentativeAnalysisScope Trap(*this); Sema::TentativeAnalysisScope Trap(*this);
ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(), ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(), {},
std::nullopt, SourceLocation()); SourceLocation());
if (R.isUsable()) { if (R.isUsable()) {
ZeroArgCallReturnTy = R.get()->getType(); ZeroArgCallReturnTy = R.get()->getType();
return true; return true;
@ -2689,7 +2689,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
// FIXME: Try this before emitting the fixit, and suppress diagnostics // FIXME: Try this before emitting the fixit, and suppress diagnostics
// while doing so. // while doing so.
E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), std::nullopt, E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), {},
Range.getEnd().getLocWithOffset(1)); Range.getEnd().getLocWithOffset(1));
return true; return true;
} }

View File

@ -6300,7 +6300,7 @@ public:
EmitFormatDiagnostic(Sema &S, bool inFunctionCall, const Expr *ArgumentExpr, EmitFormatDiagnostic(Sema &S, bool inFunctionCall, const Expr *ArgumentExpr,
const PartialDiagnostic &PDiag, SourceLocation StringLoc, const PartialDiagnostic &PDiag, SourceLocation StringLoc,
bool IsStringLocation, Range StringRange, bool IsStringLocation, Range StringRange,
ArrayRef<FixItHint> Fixit = std::nullopt); ArrayRef<FixItHint> Fixit = {});
protected: protected:
bool HandleInvalidConversionSpecifier(unsigned argIndex, SourceLocation Loc, bool HandleInvalidConversionSpecifier(unsigned argIndex, SourceLocation Loc,
@ -6327,7 +6327,7 @@ protected:
template <typename Range> template <typename Range>
void EmitFormatDiagnostic(PartialDiagnostic PDiag, SourceLocation StringLoc, void EmitFormatDiagnostic(PartialDiagnostic PDiag, SourceLocation StringLoc,
bool IsStringLocation, Range StringRange, bool IsStringLocation, Range StringRange,
ArrayRef<FixItHint> Fixit = std::nullopt); ArrayRef<FixItHint> Fixit = {});
}; };
} // namespace } // namespace

View File

@ -4567,8 +4567,7 @@ void SemaCodeCompletion::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
0) { 0) {
ParsedType T = DS.getRepAsType(); ParsedType T = DS.getRepAsType();
if (!T.get().isNull() && T.get()->isObjCObjectOrInterfaceType()) if (!T.get().isNull() && T.get()->isObjCObjectOrInterfaceType())
AddClassMessageCompletions(SemaRef, S, T, std::nullopt, false, false, AddClassMessageCompletions(SemaRef, S, T, {}, false, false, Results);
Results);
} }
// Note that we intentionally suppress macro results here, since we do not // 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()) if (E.isInvalid())
CodeCompleteExpression(S, PreferredType); CodeCompleteExpression(S, PreferredType);
else if (getLangOpts().ObjC) 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 /// The set of properties that have already been added, referenced by
@ -7747,8 +7746,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertyGetter(Scope *S) {
Results.EnterNewScope(); Results.EnterNewScope();
VisitedSelectorSet Selectors; VisitedSelectorSet Selectors;
AddObjCMethods(Class, true, MK_ZeroArgSelector, std::nullopt, AddObjCMethods(Class, true, MK_ZeroArgSelector, {}, SemaRef.CurContext,
SemaRef.CurContext, Selectors, Selectors,
/*AllowSameLength=*/true, Results); /*AllowSameLength=*/true, Results);
Results.ExitScope(); Results.ExitScope();
HandleCodeCompleteResults(&SemaRef, CodeCompleter, HandleCodeCompleteResults(&SemaRef, CodeCompleter,
@ -7776,8 +7775,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySetter(Scope *S) {
Results.EnterNewScope(); Results.EnterNewScope();
VisitedSelectorSet Selectors; VisitedSelectorSet Selectors;
AddObjCMethods(Class, true, MK_OneArgSelector, std::nullopt, AddObjCMethods(Class, true, MK_OneArgSelector, {}, SemaRef.CurContext,
SemaRef.CurContext, Selectors, Selectors,
/*AllowSameLength=*/true, Results); /*AllowSameLength=*/true, Results);
Results.ExitScope(); Results.ExitScope();
@ -8075,8 +8074,7 @@ void SemaCodeCompletion::CodeCompleteObjCMessageReceiver(Scope *S) {
if (Iface->getSuperClass()) { if (Iface->getSuperClass()) {
Results.AddResult(Result("super")); Results.AddResult(Result("super"));
AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, std::nullopt, AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, {}, Results);
Results);
} }
if (getLangOpts().CPlusPlus11) if (getLangOpts().CPlusPlus11)

View File

@ -341,7 +341,7 @@ static Expr *maybeTailCall(Sema &S, QualType RetType, Expr *E,
// EvaluateBinaryTypeTrait(BTT_IsConvertible, ...) which is at the moment // EvaluateBinaryTypeTrait(BTT_IsConvertible, ...) which is at the moment
// a private function in SemaExprCXX.cpp // 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()) if (AddressExpr.isInvalid())
return nullptr; return nullptr;
@ -392,8 +392,8 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise,
return Result.get(); return Result.get();
}; };
CallExpr *AwaitReady = cast_or_null<CallExpr>( CallExpr *AwaitReady =
BuildSubExpr(ACT::ACT_Ready, "await_ready", std::nullopt)); cast_or_null<CallExpr>(BuildSubExpr(ACT::ACT_Ready, "await_ready", {}));
if (!AwaitReady) if (!AwaitReady)
return Calls; return Calls;
if (!AwaitReady->getType()->isDependentType()) { 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. // Make sure the awaiter object gets a chance to be cleaned up.
S.Cleanup.setExprNeedsCleanups(true); S.Cleanup.setExprNeedsCleanups(true);
@ -722,8 +722,8 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc,
SourceLocation Loc = Fn->getLocation(); SourceLocation Loc = Fn->getLocation();
// Build the initial suspend point // Build the initial suspend point
auto buildSuspends = [&](StringRef Name) mutable -> StmtResult { auto buildSuspends = [&](StringRef Name) mutable -> StmtResult {
ExprResult Operand = buildPromiseCall(*this, ScopeInfo->CoroutinePromise, ExprResult Operand =
Loc, Name, std::nullopt); buildPromiseCall(*this, ScopeInfo->CoroutinePromise, Loc, Name, {});
if (Operand.isInvalid()) if (Operand.isInvalid())
return StmtError(); return StmtError();
ExprResult Suspend = ExprResult Suspend =
@ -1049,7 +1049,7 @@ StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E,
PC = buildPromiseCall(*this, Promise, Loc, "return_value", E); PC = buildPromiseCall(*this, Promise, Loc, "return_value", E);
} else { } else {
E = MakeFullDiscardedValueExpr(E).get(); E = MakeFullDiscardedValueExpr(E).get();
PC = buildPromiseCall(*this, Promise, Loc, "return_void", std::nullopt); PC = buildPromiseCall(*this, Promise, Loc, "return_void", {});
} }
if (PC.isInvalid()) if (PC.isInvalid())
return StmtError(); return StmtError();
@ -1735,8 +1735,8 @@ bool CoroutineStmtBuilder::makeOnException() {
if (!S.getLangOpts().CXXExceptions) if (!S.getLangOpts().CXXExceptions)
return true; return true;
ExprResult UnhandledException = buildPromiseCall( ExprResult UnhandledException =
S, Fn.CoroutinePromise, Loc, "unhandled_exception", std::nullopt); buildPromiseCall(S, Fn.CoroutinePromise, Loc, "unhandled_exception", {});
UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc, UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc,
/*DiscardedValue*/ false); /*DiscardedValue*/ false);
if (UnhandledException.isInvalid()) if (UnhandledException.isInvalid())
@ -1759,8 +1759,8 @@ bool CoroutineStmtBuilder::makeReturnObject() {
// [dcl.fct.def.coroutine]p7 // [dcl.fct.def.coroutine]p7
// The expression promise.get_return_object() is used to initialize the // The expression promise.get_return_object() is used to initialize the
// returned reference or prvalue result object of a call to a coroutine. // returned reference or prvalue result object of a call to a coroutine.
ExprResult ReturnObject = buildPromiseCall(S, Fn.CoroutinePromise, Loc, ExprResult ReturnObject =
"get_return_object", std::nullopt); buildPromiseCall(S, Fn.CoroutinePromise, Loc, "get_return_object", {});
if (ReturnObject.isInvalid()) if (ReturnObject.isInvalid())
return false; return false;

View File

@ -14135,8 +14135,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
InitializationKind Kind InitializationKind Kind
= InitializationKind::CreateDefault(Var->getLocation()); = InitializationKind::CreateDefault(Var->getLocation());
InitializationSequence InitSeq(*this, Entity, Kind, std::nullopt); InitializationSequence InitSeq(*this, Entity, Kind, {});
ExprResult Init = InitSeq.Perform(*this, Entity, Kind, std::nullopt); ExprResult Init = InitSeq.Perform(*this, Entity, Kind, {});
if (Init.get()) { if (Init.get()) {
Var->setInit(MaybeCreateExprWithCleanups(Init.get())); Var->setInit(MaybeCreateExprWithCleanups(Init.get()));
@ -16428,8 +16428,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
/*NumExceptions=*/0, /*NumExceptions=*/0,
/*NoexceptExpr=*/nullptr, /*NoexceptExpr=*/nullptr,
/*ExceptionSpecTokens=*/nullptr, /*ExceptionSpecTokens=*/nullptr,
/*DeclsInPrototype=*/std::nullopt, /*DeclsInPrototype=*/{}, Loc, Loc,
Loc, Loc, D), D),
std::move(DS.getAttributes()), SourceLocation()); std::move(DS.getAttributes()), SourceLocation());
D.SetIdentifier(&II, Loc); D.SetIdentifier(&II, Loc);

View File

@ -1281,7 +1281,7 @@ static bool checkTupleLikeDecomposition(Sema &S,
if (E.isInvalid()) if (E.isInvalid())
return true; return true;
E = S.BuildCallExpr(nullptr, E.get(), Loc, std::nullopt, Loc); E = S.BuildCallExpr(nullptr, E.get(), Loc, {}, Loc);
} else { } else {
// Otherwise, the initializer is get<i-1>(e), where get is looked up // Otherwise, the initializer is get<i-1>(e), where get is looked up
// in the associated namespaces. // in the associated namespaces.
@ -4797,8 +4797,8 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
case IIK_Default: { case IIK_Default: {
InitializationKind InitKind InitializationKind InitKind
= InitializationKind::CreateDefault(Constructor->getLocation()); = InitializationKind::CreateDefault(Constructor->getLocation());
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, std::nullopt); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt); BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
break; break;
} }
@ -4962,9 +4962,8 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
InitializationKind InitKind = InitializationKind InitKind =
InitializationKind::CreateDefault(Loc); InitializationKind::CreateDefault(Loc);
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, std::nullopt); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
ExprResult MemberInit = ExprResult MemberInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt);
MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
if (MemberInit.isInvalid()) if (MemberInit.isInvalid())
@ -10992,7 +10991,7 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R,
EPI.Variadic = false; EPI.Variadic = false;
EPI.TypeQuals = Qualifiers(); EPI.TypeQuals = Qualifiers();
EPI.RefQualifier = RQ_None; 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) { 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 // of the errors above fired) and with the conversion type as the
// return type. // return type.
if (D.isInvalidType()) if (D.isInvalidType())
R = Context.getFunctionType(ConvType, std::nullopt, R = Context.getFunctionType(ConvType, {}, Proto->getExtProtoInfo());
Proto->getExtProtoInfo());
// C++0x explicit conversion operators. // C++0x explicit conversion operators.
if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus20) if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus20)
@ -13867,7 +13865,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
DefaultCon->setAccess(AS_public); DefaultCon->setAccess(AS_public);
DefaultCon->setDefaulted(); DefaultCon->setDefaulted();
setupImplicitSpecialMemberType(DefaultCon, Context.VoidTy, std::nullopt); setupImplicitSpecialMemberType(DefaultCon, Context.VoidTy, {});
if (getLangOpts().CUDA) if (getLangOpts().CUDA)
CUDA().inferTargetForImplicitSpecialMember( CUDA().inferTargetForImplicitSpecialMember(
@ -14153,7 +14151,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
Destructor->setAccess(AS_public); Destructor->setAccess(AS_public);
Destructor->setDefaulted(); Destructor->setDefaulted();
setupImplicitSpecialMemberType(Destructor, Context.VoidTy, std::nullopt); setupImplicitSpecialMemberType(Destructor, Context.VoidTy, {});
if (getLangOpts().CUDA) if (getLangOpts().CUDA)
CUDA().inferTargetForImplicitSpecialMember( CUDA().inferTargetForImplicitSpecialMember(
@ -14312,8 +14310,7 @@ void Sema::AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor) {
FunctionProtoType::ExtProtoInfo EPI = DtorType->getExtProtoInfo(); FunctionProtoType::ExtProtoInfo EPI = DtorType->getExtProtoInfo();
EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.Type = EST_Unevaluated;
EPI.ExceptionSpec.SourceDecl = Destructor; EPI.ExceptionSpec.SourceDecl = Destructor;
Destructor->setType( Destructor->setType(Context.getFunctionType(Context.VoidTy, {}, EPI));
Context.getFunctionType(Context.VoidTy, std::nullopt, EPI));
// FIXME: If the destructor has a body that could throw, and the newly created // 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 // spec doesn't allow exceptions, we should emit a warning, because this
@ -15639,8 +15636,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
: CopyConstructor->getLocation(); : CopyConstructor->getLocation();
Sema::CompoundScopeRAII CompoundScope(*this); Sema::CompoundScopeRAII CompoundScope(*this);
CopyConstructor->setBody( CopyConstructor->setBody(
ActOnCompoundStmt(Loc, Loc, std::nullopt, /*isStmtExpr=*/false) ActOnCompoundStmt(Loc, Loc, {}, /*isStmtExpr=*/false).getAs<Stmt>());
.getAs<Stmt>());
CopyConstructor->markUsed(Context); CopyConstructor->markUsed(Context);
} }
@ -15771,8 +15767,7 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
: MoveConstructor->getLocation(); : MoveConstructor->getLocation();
Sema::CompoundScopeRAII CompoundScope(*this); Sema::CompoundScopeRAII CompoundScope(*this);
MoveConstructor->setBody( MoveConstructor->setBody(
ActOnCompoundStmt(Loc, Loc, std::nullopt, /*isStmtExpr=*/false) ActOnCompoundStmt(Loc, Loc, {}, /*isStmtExpr=*/false).getAs<Stmt>());
.getAs<Stmt>());
MoveConstructor->markUsed(Context); MoveConstructor->markUsed(Context);
} }
@ -17228,8 +17223,7 @@ bool Sema::EvaluateStaticAssertMessageAsString(Expr *Message,
CXXScopeSpec(), SourceLocation(), nullptr, LR, nullptr, nullptr); CXXScopeSpec(), SourceLocation(), nullptr, LR, nullptr, nullptr);
if (Res.isInvalid()) if (Res.isInvalid())
return ExprError(); return ExprError();
Res = BuildCallExpr(nullptr, Res.get(), Loc, std::nullopt, Loc, nullptr, Res = BuildCallExpr(nullptr, Res.get(), Loc, {}, Loc, nullptr, false, true);
false, true);
if (Res.isInvalid()) if (Res.isInvalid())
return ExprError(); return ExprError();
if (Res.get()->isTypeDependent() || Res.get()->isValueDependent()) if (Res.get()->isTypeDependent() || Res.get()->isValueDependent())

View File

@ -5511,10 +5511,9 @@ void SemaObjC::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
InitializationKind InitKind = InitializationKind InitKind =
InitializationKind::CreateDefault(ObjCImplementation->getLocation()); InitializationKind::CreateDefault(ObjCImplementation->getLocation());
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
std::nullopt);
ExprResult MemberInit = ExprResult MemberInit =
InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt); InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
// Note, MemberInit could actually come back empty if no initialization // Note, MemberInit could actually come back empty if no initialization
// is required (e.g., because it would call a trivial default constructor) // is required (e.g., because it would call a trivial default constructor)

View File

@ -1079,8 +1079,8 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
if (TrapFn.isInvalid()) if (TrapFn.isInvalid())
return ExprError(); return ExprError();
ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), {},
std::nullopt, E->getEndLoc()); E->getEndLoc());
if (Call.isInvalid()) if (Call.isInvalid())
return ExprError(); return ExprError();
@ -2164,8 +2164,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
TemplateArgument Arg(Lit); TemplateArgument Arg(Lit);
TemplateArgumentLocInfo ArgInfo(Lit); TemplateArgumentLocInfo ArgInfo(Lit);
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(),
StringTokLocs.back(), &ExplicitArgs); &ExplicitArgs);
} }
case LOLR_StringTemplatePack: { case LOLR_StringTemplatePack: {
@ -2185,8 +2185,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
TemplateArgumentLocInfo ArgInfo; TemplateArgumentLocInfo ArgInfo;
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
} }
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(),
StringTokLocs.back(), &ExplicitArgs); &ExplicitArgs);
} }
case LOLR_Raw: case LOLR_Raw:
case LOLR_ErrorNoDiagnostic: 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 // 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. // before we get here if it must be a template name.
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr, if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr,
std::nullopt, nullptr, &TE)) { {}, nullptr, &TE)) {
if (TE && KeywordReplacement) { if (TE && KeywordReplacement) {
auto &State = getTypoExprState(TE); auto &State = getTypoExprState(TE);
auto BestTC = State.Consumer->getNextCorrection(); auto BestTC = State.Consumer->getNextCorrection();
@ -3787,8 +3787,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
TemplateArgumentLocInfo ArgInfo; TemplateArgumentLocInfo ArgInfo;
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo)); ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
} }
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, TokLoc, return BuildLiteralOperatorCall(R, OpNameInfo, {}, TokLoc, &ExplicitArgs);
&ExplicitArgs);
} }
case LOLR_StringTemplatePack: case LOLR_StringTemplatePack:
llvm_unreachable("unexpected literal operator lookup result"); llvm_unreachable("unexpected literal operator lookup result");
@ -16245,7 +16244,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
if (isa<FunctionNoProtoType>(FTy)) { if (isa<FunctionNoProtoType>(FTy)) {
FunctionProtoType::ExtProtoInfo EPI; FunctionProtoType::ExtProtoInfo EPI;
EPI.ExtInfo = Ext; 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, // Otherwise, if we don't need to change anything about the function type,
// preserve its sugar structure. // preserve its sugar structure.
@ -16266,7 +16265,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
} else { } else {
FunctionProtoType::ExtProtoInfo EPI; FunctionProtoType::ExtProtoInfo EPI;
EPI.ExtInfo = FunctionType::ExtInfo().withNoReturn(NoReturn); EPI.ExtInfo = FunctionType::ExtInfo().withNoReturn(NoReturn);
BlockTy = Context.getFunctionType(RetTy, std::nullopt, EPI); BlockTy = Context.getFunctionType(RetTy, {}, EPI);
} }
DiagnoseUnusedParameters(BD->parameters()); DiagnoseUnusedParameters(BD->parameters());
@ -20144,7 +20143,8 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef<const Stmt*> Stmts,
bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
const PartialDiagnostic &PD) { const PartialDiagnostic &PD) {
return DiagRuntimeBehavior( return DiagRuntimeBehavior(
Loc, Statement ? llvm::ArrayRef(Statement) : std::nullopt, PD); Loc, Statement ? llvm::ArrayRef(Statement) : llvm::ArrayRef<Stmt *>(),
PD);
} }
bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc, bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc,

View File

@ -305,7 +305,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(SemaObjC &S, SourceLocation Loc,
ParmVarDecl::Create(S.SemaRef.Context, Method, SourceLocation(), ParmVarDecl::Create(S.SemaRef.Context, Method, SourceLocation(),
SourceLocation(), &CX.Idents.get("value"), SourceLocation(), &CX.Idents.get("value"),
NumberType, /*TInfo=*/nullptr, SC_None, nullptr); 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)) if (!validateBoxingMethod(S.SemaRef, Loc, S.NSNumberDecl, Sel, Method))
@ -588,7 +588,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
Context.getPointerType(ConstCharType), Context.getPointerType(ConstCharType),
/*TInfo=*/nullptr, /*TInfo=*/nullptr,
SC_None, nullptr); SC_None, nullptr);
M->setMethodParams(Context, value, std::nullopt); M->setMethodParams(Context, value, {});
BoxingMethod = M; BoxingMethod = M;
} }
@ -713,7 +713,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
SC_None, nullptr); SC_None, nullptr);
Params.push_back(type); Params.push_back(type);
M->setMethodParams(Context, Params, std::nullopt); M->setMethodParams(Context, Params, {});
BoxingMethod = M; BoxingMethod = M;
} }
@ -843,7 +843,7 @@ ExprResult SemaObjC::BuildObjCArrayLiteral(SourceRange SR,
/*TInfo=*/nullptr, SC_None, /*TInfo=*/nullptr, SC_None,
nullptr); nullptr);
Params.push_back(cnt); Params.push_back(cnt);
Method->setMethodParams(Context, Params, std::nullopt); Method->setMethodParams(Context, Params, {});
} }
if (!validateBoxingMethod(SemaRef, Loc, NSArrayDecl, Sel, Method)) if (!validateBoxingMethod(SemaRef, Loc, NSArrayDecl, Sel, Method))
@ -1012,7 +1012,7 @@ ExprResult SemaObjC::BuildObjCDictionaryLiteral(
/*TInfo=*/nullptr, SC_None, /*TInfo=*/nullptr, SC_None,
nullptr); nullptr);
Params.push_back(cnt); Params.push_back(cnt);
Method->setMethodParams(Context, Params, std::nullopt); Method->setMethodParams(Context, Params, {});
} }
if (!validateBoxingMethod(SemaRef, SR.getBegin(), NSDictionaryDecl, Sel, if (!validateBoxingMethod(SemaRef, SR.getBegin(), NSDictionaryDecl, Sel,
@ -4388,7 +4388,7 @@ bool SemaObjC::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
ExprResult msg = BuildInstanceMessageImplicit( ExprResult msg = BuildInstanceMessageImplicit(
SrcExpr, SrcType, InstanceMethod->getLocation(), SrcExpr, SrcType, InstanceMethod->getLocation(),
InstanceMethod->getSelector(), InstanceMethod, std::nullopt); InstanceMethod->getSelector(), InstanceMethod, {});
SrcExpr = msg.get(); SrcExpr = msg.get();
} }
return true; return true;

View File

@ -569,7 +569,7 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc,
true); true);
MultiExprArg SubInit; MultiExprArg SubInit;
Expr *InitExpr; Expr *InitExpr;
InitListExpr DummyInitList(SemaRef.Context, Loc, std::nullopt, Loc); InitListExpr DummyInitList(SemaRef.Context, Loc, {}, Loc);
// C++ [dcl.init.aggr]p7: // C++ [dcl.init.aggr]p7:
// If there are fewer initializer-clauses in the list than there are // 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 // Only do this if we're initializing a class type, to avoid filling in
// the initializer list where possible. // the initializer list where possible.
InitExpr = VerifyOnly InitExpr = VerifyOnly ? &DummyInitList
? &DummyInitList : new (SemaRef.Context)
: new (SemaRef.Context) InitListExpr(SemaRef.Context, Loc, {}, Loc);
InitListExpr(SemaRef.Context, Loc, std::nullopt, Loc);
InitExpr->setType(SemaRef.Context.VoidTy); InitExpr->setType(SemaRef.Context.VoidTy);
SubInit = InitExpr; SubInit = InitExpr;
Kind = InitializationKind::CreateCopy(Loc, Loc); Kind = InitializationKind::CreateCopy(Loc, Loc);
@ -3403,7 +3402,7 @@ InitListChecker::createInitListExpr(QualType CurrentObjectType,
SourceRange InitRange, SourceRange InitRange,
unsigned ExpectedNumInits) { unsigned ExpectedNumInits) {
InitListExpr *Result = new (SemaRef.Context) InitListExpr( InitListExpr *Result = new (SemaRef.Context) InitListExpr(
SemaRef.Context, InitRange.getBegin(), std::nullopt, InitRange.getEnd()); SemaRef.Context, InitRange.getBegin(), {}, InitRange.getEnd());
QualType ResultType = CurrentObjectType; QualType ResultType = CurrentObjectType;
if (!ResultType->isArrayType()) if (!ResultType->isArrayType())
@ -5650,7 +5649,7 @@ static void TryDefaultInitialization(Sema &S,
// constructor for T is called (and the initialization is ill-formed if // constructor for T is called (and the initialization is ill-formed if
// T has no accessible default constructor); // T has no accessible default constructor);
if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) { if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) {
TryConstructorInitialization(S, Entity, Kind, std::nullopt, DestType, TryConstructorInitialization(S, Entity, Kind, {}, DestType,
Entity.getType(), Sequence); Entity.getType(), Sequence);
return; return;
} }
@ -5687,11 +5686,13 @@ static void TryOrBuildParenListInitialization(
const InitializationKind &SubKind, const InitializationKind &SubKind,
Expr *Arg, Expr **InitExpr = nullptr) { Expr *Arg, Expr **InitExpr = nullptr) {
InitializationSequence IS = InitializationSequence( InitializationSequence IS = InitializationSequence(
S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt); S, SubEntity, SubKind,
Arg ? MultiExprArg(Arg) : MutableArrayRef<Expr *>());
if (IS.Failed()) { if (IS.Failed()) {
if (!VerifyOnly) { if (!VerifyOnly) {
IS.Diagnose(S, SubEntity, SubKind, Arg ? ArrayRef(Arg) : std::nullopt); IS.Diagnose(S, SubEntity, SubKind,
Arg ? ArrayRef(Arg) : ArrayRef<Expr *>());
} else { } else {
Sequence.SetFailed( Sequence.SetFailed(
InitializationSequence::FK_ParenthesizedListInitFailed); InitializationSequence::FK_ParenthesizedListInitFailed);
@ -5702,7 +5703,7 @@ static void TryOrBuildParenListInitialization(
if (!VerifyOnly) { if (!VerifyOnly) {
ExprResult ER; ExprResult ER;
ER = IS.Perform(S, SubEntity, SubKind, ER = IS.Perform(S, SubEntity, SubKind,
Arg ? MultiExprArg(Arg) : std::nullopt); Arg ? MultiExprArg(Arg) : MutableArrayRef<Expr *>());
if (ER.isInvalid()) if (ER.isInvalid())
return false; return false;

View File

@ -909,8 +909,8 @@ getDummyLambdaType(Sema &S, SourceLocation Loc = SourceLocation()) {
QualType DefaultTypeForNoTrailingReturn = S.getLangOpts().CPlusPlus14 QualType DefaultTypeForNoTrailingReturn = S.getLangOpts().CPlusPlus14
? S.Context.getAutoDeductType() ? S.Context.getAutoDeductType()
: S.Context.DependentTy; : S.Context.DependentTy;
QualType MethodTy = S.Context.getFunctionType(DefaultTypeForNoTrailingReturn, QualType MethodTy =
std::nullopt, EPI); S.Context.getFunctionType(DefaultTypeForNoTrailingReturn, {}, EPI);
return S.Context.getTrivialTypeSourceInfo(MethodTy, Loc); return S.Context.getTrivialTypeSourceInfo(MethodTy, Loc);
} }
@ -1681,8 +1681,7 @@ static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange,
ConvExtInfo.TypeQuals = Qualifiers(); ConvExtInfo.TypeQuals = Qualifiers();
ConvExtInfo.TypeQuals.addConst(); ConvExtInfo.TypeQuals.addConst();
ConvExtInfo.ExceptionSpec.Type = EST_BasicNoexcept; ConvExtInfo.ExceptionSpec.Type = EST_BasicNoexcept;
QualType ConvTy = QualType ConvTy = S.Context.getFunctionType(PtrToFunctionTy, {}, ConvExtInfo);
S.Context.getFunctionType(PtrToFunctionTy, std::nullopt, ConvExtInfo);
SourceLocation Loc = IntroducerRange.getBegin(); SourceLocation Loc = IntroducerRange.getBegin();
DeclarationName ConversionName DeclarationName ConversionName
@ -1864,8 +1863,7 @@ static void addBlockPointerConversion(Sema &S,
/*IsVariadic=*/false, /*IsCXXMethod=*/true)); /*IsVariadic=*/false, /*IsCXXMethod=*/true));
ConversionEPI.TypeQuals = Qualifiers(); ConversionEPI.TypeQuals = Qualifiers();
ConversionEPI.TypeQuals.addConst(); ConversionEPI.TypeQuals.addConst();
QualType ConvTy = QualType ConvTy = S.Context.getFunctionType(BlockPtrTy, {}, ConversionEPI);
S.Context.getFunctionType(BlockPtrTy, std::nullopt, ConversionEPI);
SourceLocation Loc = IntroducerRange.getBegin(); SourceLocation Loc = IntroducerRange.getBegin();
DeclarationName Name DeclarationName Name

View File

@ -1200,7 +1200,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_C); EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_C);
EPI.ExceptionSpec = EST_None; EPI.ExceptionSpec = EST_None;
QualType ExpectedType = R.getSema().Context.getFunctionType( 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 // Perform template argument deduction against the type that we would
// expect the function to have. // expect the function to have.

View File

@ -2552,7 +2552,7 @@ void SemaObjC::ProcessPropertyDecl(ObjCPropertyDecl *property) {
/*TInfo=*/nullptr, /*TInfo=*/nullptr,
SC_None, SC_None,
nullptr); nullptr);
SetterMethod->setMethodParams(Context, Argument, std::nullopt); SetterMethod->setMethodParams(Context, Argument, {});
AddPropertyAttrs(SemaRef, SetterMethod, property); AddPropertyAttrs(SemaRef, SetterMethod, property);

View File

@ -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 // Fill in a dummy 'length' so that when we instantiate this we don't
// double-diagnose here. // double-diagnose here.
ExprResult Recovery = SemaRef.CreateRecoveryExpr( ExprResult Recovery = SemaRef.CreateRecoveryExpr(
ColonLoc, SourceLocation(), ArrayRef<Expr *>{std::nullopt}, ColonLoc, SourceLocation(), ArrayRef<Expr *>(), Context.IntTy);
Context.IntTy);
Length = Recovery.isUsable() ? Recovery.get() : nullptr; Length = Recovery.isUsable() ? Recovery.get() : nullptr;
} }

View File

@ -15901,9 +15901,9 @@ OMPClause *SemaOpenMP::ActOnOpenMPSimpleClause(
return Res; return Res;
} }
static std::string static std::string getListOfPossibleValues(OpenMPClauseKind K, unsigned First,
getListOfPossibleValues(OpenMPClauseKind K, unsigned First, unsigned Last, unsigned Last,
ArrayRef<unsigned> Exclude = std::nullopt) { ArrayRef<unsigned> Exclude = {}) {
SmallString<256> Buffer; SmallString<256> Buffer;
llvm::raw_svector_ostream Out(Buffer); llvm::raw_svector_ostream Out(Buffer);
unsigned Skipped = Exclude.size(); unsigned Skipped = Exclude.size();
@ -21296,7 +21296,7 @@ static void checkMappableExpressionList(
CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo MapperId, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo MapperId,
ArrayRef<Expr *> UnresolvedMappers, ArrayRef<Expr *> UnresolvedMappers,
OpenMPMapClauseKind MapType = OMPC_MAP_unknown, OpenMPMapClauseKind MapType = OMPC_MAP_unknown,
ArrayRef<OpenMPMapModifierKind> Modifiers = std::nullopt, ArrayRef<OpenMPMapModifierKind> Modifiers = {},
bool IsMapTypeImplicit = false, bool NoDiagnose = false) { bool IsMapTypeImplicit = false, bool NoDiagnose = false) {
// We only expect mappable expressions in 'to', 'from', and 'map' clauses. // We only expect mappable expressions in 'to', 'from', and 'map' clauses.
assert((CKind == OMPC_map || CKind == OMPC_to || CKind == OMPC_from) && assert((CKind == OMPC_map || CKind == OMPC_to || CKind == OMPC_from) &&

Some files were not shown because too many files have changed in this diff Show More