[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) {
if (!Source.empty())
return Source.copy(Allocator);
return std::nullopt;
return {};
}
ParagraphComment *actOnParagraphComment(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1470,7 +1470,7 @@ public:
static bool classof(const SExpr *E) { return E->opcode() == COP_Return; }
/// Return an empty list.
ArrayRef<BasicBlock *> successors() { return std::nullopt; }
ArrayRef<BasicBlock *> successors() { return {}; }
SExpr *returnValue() { 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_Return: return cast<Return>(this)->successors();
default:
return std::nullopt;
return {};
}
}

View File

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

View File

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

View File

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

View File

@ -836,7 +836,7 @@ public:
bool StorePreamblesInMemory = false,
StringRef PreambleStoragePath = StringRef(), bool OnlyLocalDecls = false,
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
ArrayRef<RemappedFile> RemappedFiles = std::nullopt,
ArrayRef<RemappedFile> RemappedFiles = {},
bool RemappedFilesKeepOriginalName = true,
unsigned PrecompilePreambleAfterNParses = 0,
TranslationUnitKind TUKind = TU_Complete,
@ -864,7 +864,7 @@ public:
/// \returns True if a failure occurred that causes the ASTUnit not to
/// contain any translation-unit information, false otherwise.
bool Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
ArrayRef<RemappedFile> RemappedFiles = std::nullopt,
ArrayRef<RemappedFile> RemappedFiles = {},
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
/// 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 {
if (auto *Info = getModuleInfo(PP, II))
return Info->ActiveModuleMacros;
return std::nullopt;
return {};
}
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
@ -935,7 +935,7 @@ private:
ArrayRef<ModuleMacro*> getOverriddenMacros() const {
if (auto *Info = State.dyn_cast<ModuleMacroInfo*>())
return Info->OverriddenMacros;
return std::nullopt;
return {};
}
void setOverriddenMacros(Preprocessor &PP,
@ -1444,7 +1444,7 @@ public:
auto I = LeafModuleMacros.find(II);
if (I != LeafModuleMacros.end())
return I->second;
return std::nullopt;
return {};
}
/// Get the list of submodules that we're currently building.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ public:
FTy = llvm::FunctionType::get(RetTy, ArgTys, false);
}
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))
cast<llvm::LoadInst>(IvarOffsetValue)
->setMetadata(llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(VMContext, std::nullopt));
llvm::MDNode::get(VMContext, {}));
}
// This could be 32bit int or 64bit integer depending on the architecture.
@ -7589,7 +7589,7 @@ llvm::Value *CGObjCNonFragileABIMac::EmitSelector(CodeGenFunction &CGF,
llvm::LoadInst* LI = CGF.Builder.CreateLoad(Addr);
LI->setMetadata(llvm::LLVMContext::MD_invariant_load,
llvm::MDNode::get(VMContext, std::nullopt));
llvm::MDNode::get(VMContext, {}));
return LI;
}

View File

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

View File

@ -352,7 +352,7 @@ protected:
/// Emits \p Callee function call with arguments \p Args with location \p Loc.
void emitCall(CodeGenFunction &CGF, SourceLocation Loc,
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
/// stored.
@ -1543,7 +1543,7 @@ public:
virtual void
emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc,
llvm::FunctionCallee OutlinedFn,
ArrayRef<llvm::Value *> Args = std::nullopt) const;
ArrayRef<llvm::Value *> Args = {}) const;
/// Emits OpenMP-specific function prolog.
/// Required for device constructs.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -286,8 +286,8 @@ void Preprocessor::dumpMacroInfo(const IdentifierInfo *II) {
// Dump module macros.
llvm::DenseSet<ModuleMacro*> Active;
for (auto *MM :
State ? State->getActiveModuleMacros(*this, II) : std::nullopt)
for (auto *MM : State ? State->getActiveModuleMacros(*this, II)
: ArrayRef<ModuleMacro *>())
Active.insert(MM);
llvm::DenseSet<ModuleMacro*> Visited;
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.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
std::nullopt, LAngleLoc, nullptr));
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
LAngleLoc, nullptr));
TheDecl = ParseFunctionDefinition(
D,
@ -2787,8 +2787,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
// Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
std::nullopt, LAngleLoc, nullptr));
0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
LAngleLoc, nullptr));
ThisDecl =
Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions);
FnBody =
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
}
BodyScope.Exit();
@ -2596,8 +2595,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
// compound statement as the body.
if (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions);
FnBody =
Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
}
BodyScope.Exit();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1079,8 +1079,8 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
if (TrapFn.isInvalid())
return ExprError();
ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(),
std::nullopt, E->getEndLoc());
ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), {},
E->getEndLoc());
if (Call.isInvalid())
return ExprError();
@ -2164,8 +2164,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
TemplateArgument Arg(Lit);
TemplateArgumentLocInfo ArgInfo(Lit);
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt,
StringTokLocs.back(), &ExplicitArgs);
return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(),
&ExplicitArgs);
}
case LOLR_StringTemplatePack: {
@ -2185,8 +2185,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
TemplateArgumentLocInfo ArgInfo;
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
}
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt,
StringTokLocs.back(), &ExplicitArgs);
return BuildLiteralOperatorCall(R, OpNameInfo, {}, StringTokLocs.back(),
&ExplicitArgs);
}
case LOLR_Raw:
case LOLR_ErrorNoDiagnostic:
@ -2801,7 +2801,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
// a template name, but we happen to have always already looked up the name
// before we get here if it must be a template name.
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr,
std::nullopt, nullptr, &TE)) {
{}, nullptr, &TE)) {
if (TE && KeywordReplacement) {
auto &State = getTypoExprState(TE);
auto BestTC = State.Consumer->getNextCorrection();
@ -3787,8 +3787,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
TemplateArgumentLocInfo ArgInfo;
ExplicitArgs.addArgument(TemplateArgumentLoc(Arg, ArgInfo));
}
return BuildLiteralOperatorCall(R, OpNameInfo, std::nullopt, TokLoc,
&ExplicitArgs);
return BuildLiteralOperatorCall(R, OpNameInfo, {}, TokLoc, &ExplicitArgs);
}
case LOLR_StringTemplatePack:
llvm_unreachable("unexpected literal operator lookup result");
@ -16245,7 +16244,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
if (isa<FunctionNoProtoType>(FTy)) {
FunctionProtoType::ExtProtoInfo EPI;
EPI.ExtInfo = Ext;
BlockTy = Context.getFunctionType(RetTy, std::nullopt, EPI);
BlockTy = Context.getFunctionType(RetTy, {}, EPI);
// Otherwise, if we don't need to change anything about the function type,
// preserve its sugar structure.
@ -16266,7 +16265,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
} else {
FunctionProtoType::ExtProtoInfo EPI;
EPI.ExtInfo = FunctionType::ExtInfo().withNoReturn(NoReturn);
BlockTy = Context.getFunctionType(RetTy, std::nullopt, EPI);
BlockTy = Context.getFunctionType(RetTy, {}, EPI);
}
DiagnoseUnusedParameters(BD->parameters());
@ -20144,7 +20143,8 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef<const Stmt*> Stmts,
bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
const PartialDiagnostic &PD) {
return DiagRuntimeBehavior(
Loc, Statement ? llvm::ArrayRef(Statement) : std::nullopt, PD);
Loc, Statement ? llvm::ArrayRef(Statement) : llvm::ArrayRef<Stmt *>(),
PD);
}
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(),
SourceLocation(), &CX.Idents.get("value"),
NumberType, /*TInfo=*/nullptr, SC_None, nullptr);
Method->setMethodParams(S.SemaRef.Context, value, std::nullopt);
Method->setMethodParams(S.SemaRef.Context, value, {});
}
if (!validateBoxingMethod(S.SemaRef, Loc, S.NSNumberDecl, Sel, Method))
@ -588,7 +588,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
Context.getPointerType(ConstCharType),
/*TInfo=*/nullptr,
SC_None, nullptr);
M->setMethodParams(Context, value, std::nullopt);
M->setMethodParams(Context, value, {});
BoxingMethod = M;
}
@ -713,7 +713,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
SC_None, nullptr);
Params.push_back(type);
M->setMethodParams(Context, Params, std::nullopt);
M->setMethodParams(Context, Params, {});
BoxingMethod = M;
}
@ -843,7 +843,7 @@ ExprResult SemaObjC::BuildObjCArrayLiteral(SourceRange SR,
/*TInfo=*/nullptr, SC_None,
nullptr);
Params.push_back(cnt);
Method->setMethodParams(Context, Params, std::nullopt);
Method->setMethodParams(Context, Params, {});
}
if (!validateBoxingMethod(SemaRef, Loc, NSArrayDecl, Sel, Method))
@ -1012,7 +1012,7 @@ ExprResult SemaObjC::BuildObjCDictionaryLiteral(
/*TInfo=*/nullptr, SC_None,
nullptr);
Params.push_back(cnt);
Method->setMethodParams(Context, Params, std::nullopt);
Method->setMethodParams(Context, Params, {});
}
if (!validateBoxingMethod(SemaRef, SR.getBegin(), NSDictionaryDecl, Sel,
@ -4388,7 +4388,7 @@ bool SemaObjC::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
ExprResult msg = BuildInstanceMessageImplicit(
SrcExpr, SrcType, InstanceMethod->getLocation(),
InstanceMethod->getSelector(), InstanceMethod, std::nullopt);
InstanceMethod->getSelector(), InstanceMethod, {});
SrcExpr = msg.get();
}
return true;

View File

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

View File

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

View File

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

View File

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

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
// double-diagnose here.
ExprResult Recovery = SemaRef.CreateRecoveryExpr(
ColonLoc, SourceLocation(), ArrayRef<Expr *>{std::nullopt},
Context.IntTy);
ColonLoc, SourceLocation(), ArrayRef<Expr *>(), Context.IntTy);
Length = Recovery.isUsable() ? Recovery.get() : nullptr;
}

View File

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

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