[clang] 4dd55c5 - [clang] Use {} instead of std::nullopt to initialize empty ArrayRef (#109399)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 02:23:45 PDT 2024
Author: Jay Foad
Date: 2024-10-24T10:23:40+01:00
New Revision: 4dd55c567aaed30c6842812e0798a70fee324c98
URL: https://github.com/llvm/llvm-project/commit/4dd55c567aaed30c6842812e0798a70fee324c98
DIFF: https://github.com/llvm/llvm-project/commit/4dd55c567aaed30c6842812e0798a70fee324c98.diff
LOG: [clang] Use {} instead of std::nullopt to initialize empty ArrayRef (#109399)
Follow up to #109133.
Added:
Modified:
clang/include/clang/AST/CommentSema.h
clang/include/clang/AST/DeclFriend.h
clang/include/clang/AST/DeclObjC.h
clang/include/clang/AST/DeclOpenMP.h
clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/StmtOpenMP.h
clang/include/clang/AST/TemplateBase.h
clang/include/clang/ASTMatchers/ASTMatchersInternal.h
clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
clang/include/clang/Analysis/AnyCall.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Driver/Job.h
clang/include/clang/Frontend/ASTUnit.h
clang/include/clang/Lex/Preprocessor.h
clang/include/clang/Sema/CodeCompleteConsumer.h
clang/include/clang/Sema/Overload.h
clang/include/clang/Sema/Sema.h
clang/include/clang/Sema/SemaObjC.h
clang/include/clang/Sema/SemaOpenACC.h
clang/include/clang/Sema/SemaOpenMP.h
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
clang/lib/ARCMigrate/Internals.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Comment.cpp
clang/lib/AST/CommentParser.cpp
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/DeclObjC.cpp
clang/lib/AST/DeclOpenMP.cpp
clang/lib/AST/DeclTemplate.cpp
clang/lib/AST/Expr.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/AST/StmtOpenMP.cpp
clang/lib/Analysis/BodyFarm.cpp
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/lib/Basic/Targets/AMDGPU.h
clang/lib/Basic/Targets/ARC.h
clang/lib/Basic/Targets/AVR.h
clang/lib/Basic/Targets/BPF.h
clang/lib/Basic/Targets/DirectX.h
clang/lib/Basic/Targets/Lanai.h
clang/lib/Basic/Targets/M68k.cpp
clang/lib/Basic/Targets/MSP430.h
clang/lib/Basic/Targets/NVPTX.h
clang/lib/Basic/Targets/PNaCl.cpp
clang/lib/Basic/Targets/PNaCl.h
clang/lib/Basic/Targets/SPIR.h
clang/lib/Basic/Targets/Sparc.h
clang/lib/Basic/Targets/SystemZ.h
clang/lib/Basic/Targets/TCE.h
clang/lib/Basic/Targets/WebAssembly.h
clang/lib/Basic/Targets/X86.h
clang/lib/Basic/Targets/XCore.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGCleanup.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGLoopInfo.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Frontend/DiagnosticRenderer.cpp
clang/lib/Index/IndexingContext.h
clang/lib/Lex/ModuleMap.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Parse/ParseInit.cpp
clang/lib/Parse/ParseObjc.cpp
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaObjCProperty.cpp
clang/lib/Sema/SemaOpenACC.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaPseudoObject.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeductionGuide.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTWriterDecl.cpp
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/tools/libclang/CIndex.cpp
clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
clang/unittests/Frontend/ASTUnitTest.cpp
clang/utils/TableGen/NeonEmitter.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/CommentSema.h b/clang/include/clang/AST/CommentSema.h
index 03f13283ac0d97..916d7945329c5b 100644
--- a/clang/include/clang/AST/CommentSema.h
+++ b/clang/include/clang/AST/CommentSema.h
@@ -80,7 +80,7 @@ class Sema {
ArrayRef<T> copyArray(ArrayRef<T> Source) {
if (!Source.empty())
return Source.copy(Allocator);
- return std::nullopt;
+ return {};
}
ParagraphComment *actOnParagraphComment(
diff --git a/clang/include/clang/AST/DeclFriend.h b/clang/include/clang/AST/DeclFriend.h
index 095f14a81fd574..1578580c89cd87 100644
--- a/clang/include/clang/AST/DeclFriend.h
+++ b/clang/include/clang/AST/DeclFriend.h
@@ -115,7 +115,7 @@ class FriendDecl final
static FriendDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_,
SourceLocation FriendL, SourceLocation EllipsisLoc = {},
- ArrayRef<TemplateParameterList *> FriendTypeTPLists = std::nullopt);
+ ArrayRef<TemplateParameterList *> FriendTypeTPLists = {});
static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
unsigned FriendTypeNumTPLists);
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 1cda70530d7d83..4663603f797545 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -386,7 +386,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
/// If the method is implicit (not coming from source) \p SelLocs is
/// ignored.
void setMethodParams(ASTContext &C, ArrayRef<ParmVarDecl *> Params,
- ArrayRef<SourceLocation> SelLocs = std::nullopt);
+ ArrayRef<SourceLocation> SelLocs = {});
// Iterator access to parameter types.
struct GetTypeFn {
diff --git a/clang/include/clang/AST/DeclOpenMP.h b/clang/include/clang/AST/DeclOpenMP.h
index 868662208efa1f..cf383889c0ad90 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -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 @@ template <typename U> class OMPDeclarativeDirective : public U {
ArrayRef<OMPClause *> clauses() const {
if (!Data)
- return std::nullopt;
+ return {};
return Data->getClauses();
}
};
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index cfe3938f83847b..57ab94bcb2010f 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -4306,11 +4306,11 @@ class SizeOfPackExpr final
: Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
public:
- static SizeOfPackExpr *
- Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack,
- SourceLocation PackLoc, SourceLocation RParenLoc,
- std::optional<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);
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 2e48c1c3c72c8e..9cf46f73f6e46d 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -6108,14 +6108,14 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
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 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
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();
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index 930670d17f2d1c..9ec49b8683dc8e 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -277,7 +277,7 @@ class OMPExecutableDirective : public Stmt {
/// Get the clauses storage.
MutableArrayRef<OMPClause *> getClauses() {
if (!Data)
- return std::nullopt;
+ return {};
return Data->getClauses();
}
@@ -572,7 +572,7 @@ class OMPExecutableDirective : public Stmt {
ArrayRef<OMPClause *> clauses() const {
if (!Data)
- return std::nullopt;
+ return {};
return Data->getClauses();
}
diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h
index 0eaa4b0eedb35f..a8f0263d5505ac 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -283,7 +283,7 @@ class TemplateArgument {
}
static TemplateArgument getEmptyPack() {
- return TemplateArgument(std::nullopt);
+ return TemplateArgument(ArrayRef<TemplateArgument>());
}
/// Create a new template argument pack by copying the given set of
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index c1cc63fdb7433f..ab8b146453e761 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -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>
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
index 65dd66ee093fe4..2f202607bd3fa9 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
@@ -1470,7 +1470,7 @@ class Return : public Terminator {
static bool classof(const SExpr *E) { return E->opcode() == COP_Return; }
/// Return an empty list.
- ArrayRef<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 {};
}
}
diff --git a/clang/include/clang/Analysis/AnyCall.h b/clang/include/clang/Analysis/AnyCall.h
index 48abce062d1330..3e95366c985956 100644
--- a/clang/include/clang/Analysis/AnyCall.h
+++ b/clang/include/clang/Analysis/AnyCall.h
@@ -143,7 +143,7 @@ class AnyCall {
/// \returns formal parameters for direct calls (including virtual calls)
ArrayRef<ParmVarDecl *> parameters() const {
if (!D)
- return std::nullopt;
+ return {};
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
return FD->parameters();
@@ -152,7 +152,7 @@ class AnyCall {
} else if (const auto *BD = dyn_cast<BlockDecl>(D)) {
return BD->parameters();
} else {
- return std::nullopt;
+ return {};
}
}
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index e7469e1e989128..17262d5968b12d 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1858,11 +1858,9 @@ class TargetInfo : public TransferrableTargetInfo,
}
virtual ArrayRef<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;
diff --git a/clang/include/clang/Driver/Job.h b/clang/include/clang/Driver/Job.h
index df9449463c53bd..561866197b7803 100644
--- a/clang/include/clang/Driver/Job.h
+++ b/clang/include/clang/Driver/Job.h
@@ -172,8 +172,7 @@ class Command {
Command(const Action &Source, const Tool &Creator,
ResponseFileSupport ResponseSupport, const char *Executable,
const llvm::opt::ArgStringList &Arguments, ArrayRef<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 @@ class CC1Command : public Command {
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,
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 8cefae8587aa34..1f98c6ab328baa 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -836,7 +836,7 @@ class ASTUnit {
bool StorePreamblesInMemory = false,
StringRef PreambleStoragePath = StringRef(), bool OnlyLocalDecls = false,
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
- ArrayRef<RemappedFile> RemappedFiles = std::nullopt,
+ ArrayRef<RemappedFile> RemappedFiles = {},
bool RemappedFilesKeepOriginalName = true,
unsigned PrecompilePreambleAfterNParses = 0,
TranslationUnitKind TUKind = TU_Complete,
@@ -864,7 +864,7 @@ class ASTUnit {
/// \returns True if a failure occurred that causes the ASTUnit not to
/// contain any translation-unit information, false otherwise.
bool Reparse(std::shared_ptr<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.
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 92749e4de44b57..f3f4de044fc41a 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -911,7 +911,7 @@ class Preprocessor {
getActiveModuleMacros(Preprocessor &PP, const IdentifierInfo *II) const {
if (auto *Info = getModuleInfo(PP, II))
return Info->ActiveModuleMacros;
- return std::nullopt;
+ return {};
}
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
@@ -935,7 +935,7 @@ class Preprocessor {
ArrayRef<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 @@ class Preprocessor {
auto I = LeafModuleMacros.find(II);
if (I != LeafModuleMacros.end())
return I->second;
- return std::nullopt;
+ return {};
}
/// Get the list of submodules that we're currently building.
diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h
index 0924dc27af82b5..2dd27593778c7c 100644
--- a/clang/include/clang/Sema/CodeCompleteConsumer.h
+++ b/clang/include/clang/Sema/CodeCompleteConsumer.h
@@ -375,12 +375,11 @@ class CodeCompletionContext {
public:
/// Construct a new code-completion context of the given kind.
CodeCompletionContext(Kind CCKind)
- : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(std::nullopt) {}
+ : CCKind(CCKind), IsUsingDeclaration(false), SelIdents() {}
/// Construct a new code-completion context of the given kind.
- CodeCompletionContext(
- Kind CCKind, QualType T,
- ArrayRef<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 ||
diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h
index c716a25bb673b8..58fa64c80a16f0 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -1206,9 +1206,8 @@ class Sema;
/// Add a new candidate with NumConversions conversion sequence slots
/// to the overload set.
- OverloadCandidate &
- addCandidate(unsigned NumConversions = 0,
- ConversionSequenceList Conversions = std::nullopt) {
+ OverloadCandidate &addCandidate(unsigned NumConversions = 0,
+ ConversionSequenceList Conversions = {}) {
assert((Conversions.empty() || Conversions.size() == NumConversions) &&
"preallocated conversion sequence has wrong length");
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 9e6b04bc3f8f7c..93d98e1cbb9c81 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3478,10 +3478,12 @@ class Sema final : public SemaBase {
/// a C++0x [dcl.typedef]p2 alias-declaration: 'using T = A;'.
NamedDecl *ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D,
LookupResult &Previous, bool &Redeclaration);
- NamedDecl *ActOnVariableDeclarator(
- Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo,
- LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists,
- bool &AddToScope, ArrayRef<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 @@ class Sema final : public SemaBase {
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 @@ class Sema final : public SemaBase {
/// \param SkipLocalVariables If true, don't mark local variables as
/// 'referenced'.
/// \param StopAt Subexpressions that we shouldn't recurse into.
- void MarkDeclarationsReferencedInExpr(
- Expr *E, bool SkipLocalVariables = false,
- ArrayRef<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 @@ class Sema final : public SemaBase {
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 @@ class Sema final : public SemaBase {
/// \param PartialOverloading true if we are performing "partial" overloading
/// based on an incomplete set of function arguments. This feature is used by
/// code completion.
- void AddOverloadCandidate(
- FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef<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 @@ class Sema final : public SemaBase {
/// both @c a1 and @c a2. If @p SuppressUserConversions, then don't
/// allow user-defined conversions via constructors or conversion
/// operators.
- void
- AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
- CXXRecordDecl *ActingContext, QualType ObjectType,
- Expr::Classification ObjectClassification,
- ArrayRef<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 @@ class Sema final : public SemaBase {
bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
SourceRange InstantiationRange);
- InstantiatingTemplate(
- Sema &SemaRef, CodeSynthesisContext::SynthesisKind Kind,
- SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
- Decl *Entity, NamedDecl *Template = nullptr,
- ArrayRef<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;
diff --git a/clang/include/clang/Sema/SemaObjC.h b/clang/include/clang/Sema/SemaObjC.h
index 9367c680953f71..1332eb4f4d4233 100644
--- a/clang/include/clang/Sema/SemaObjC.h
+++ b/clang/include/clang/Sema/SemaObjC.h
@@ -336,8 +336,8 @@ class SemaObjC : public SemaBase {
ObjCInterfaceDecl *ID);
Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
- ArrayRef<Decl *> allMethods = std::nullopt,
- ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
+ ArrayRef<Decl *> allMethods = {},
+ ArrayRef<DeclGroupPtrTy> allTUVars = {});
struct ObjCArgInfo {
IdentifierInfo *Name;
diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h
index d6e56f85e2d54e..a34551f6b5a192 100644
--- a/clang/include/clang/Sema/SemaOpenACC.h
+++ b/clang/include/clang/Sema/SemaOpenACC.h
@@ -274,7 +274,7 @@ class SemaOpenACC : public SemaBase {
"Parsed clause kind does not have a queue id expr list");
if (std::holds_alternative<std::monostate>(Details))
- return ArrayRef<Expr *>{std::nullopt};
+ return ArrayRef<Expr *>();
return std::get<WaitDetails>(Details).QueueIdExprs;
}
diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h
index 80ad30b0f99efc..1bf71b13cbb0f7 100644
--- a/clang/include/clang/Sema/SemaOpenMP.h
+++ b/clang/include/clang/Sema/SemaOpenMP.h
@@ -1196,21 +1196,21 @@ class SemaOpenMP : public SemaBase {
SourceLocation ModifierLoc, SourceLocation ColonLoc,
SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId,
- ArrayRef<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 @@ class SemaOpenMP : public SemaBase {
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 @@ class SemaOpenMP : public SemaBase {
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 @@ class SemaOpenMP : public SemaBase {
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);
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index ead96ce6891c39..8974342166fadd 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -644,14 +644,14 @@ class BugReporter {
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker,
StringRef BugName, StringRef BugCategory,
StringRef BugStr, PathDiagnosticLocation Loc,
- ArrayRef<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;
diff --git a/clang/lib/ARCMigrate/Internals.h b/clang/lib/ARCMigrate/Internals.h
index d790c7c02189b8..de6ebdce1bea16 100644
--- a/clang/lib/ARCMigrate/Internals.h
+++ b/clang/lib/ARCMigrate/Internals.h
@@ -74,7 +74,7 @@ class TransformActions {
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 };
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index a4e8d95035b974..69892bda42b256 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1052,7 +1052,7 @@ ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) {
auto MergedIt =
MergedDefModules.find(cast<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);
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp
index cce8b12170f21f..d022c5c845ae62 100644
--- a/clang/lib/AST/Comment.cpp
+++ b/clang/lib/AST/Comment.cpp
@@ -210,7 +210,7 @@ void DeclInfo::fill() {
IsInstanceMethod = false;
IsClassMethod = false;
IsVariadic = false;
- ParamVars = std::nullopt;
+ ParamVars = {};
TemplateParameters = nullptr;
if (!CommentDecl) {
diff --git a/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp
index d5e5bb27ceba3c..61508fe886efc0 100644
--- a/clang/lib/AST/CommentParser.cpp
+++ b/clang/lib/AST/CommentParser.cpp
@@ -499,7 +499,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
if (isTokBlockCommand()) {
// Block command ahead. We can't nest block commands, so pretend that this
// command has an empty argument.
- ParagraphComment *Paragraph = S.actOnParagraphComment(std::nullopt);
+ ParagraphComment *Paragraph = S.actOnParagraphComment({});
if (PC) {
S.actOnParamCommandFinish(PC, Paragraph);
return PC;
@@ -547,7 +547,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
ParagraphComment *Paragraph;
if (EmptyParagraph)
- Paragraph = S.actOnParagraphComment(std::nullopt);
+ Paragraph = S.actOnParagraphComment({});
else {
BlockContentComment *Block = parseParagraphOrBlockCommand();
// Since we have checked for a block command, we should have parsed a
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 8321cee0e0bc94..86913763ef9ff5 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5506,9 +5506,8 @@ IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) {
- return new (C, ID)
- IndirectFieldDecl(C, nullptr, SourceLocation(), DeclarationName(),
- QualType(), std::nullopt);
+ return new (C, ID) IndirectFieldDecl(C, nullptr, SourceLocation(),
+ DeclarationName(), QualType(), {});
}
SourceRange EnumConstantDecl::getSourceRange() const {
@@ -5748,7 +5747,7 @@ ImportDecl *ImportDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
ArrayRef<SourceLocation> ImportDecl::getIdentifierLocs() const {
if (!isImportComplete())
- return std::nullopt;
+ return {};
const auto *StoredLocs = getTrailingObjects<SourceLocation>();
return llvm::ArrayRef(StoredLocs,
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 17ebee0d6b22fa..db0ea62a2323eb 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -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 *>();
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 83062b0e68878d..ae8a310769260c 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -947,12 +947,12 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,
assert((!SelLocs.empty() || isImplicit()) &&
"No selector locs for non-implicit method");
if (isImplicit())
- return setParamsAndSelLocs(C, Params, std::nullopt);
+ return setParamsAndSelLocs(C, Params, {});
setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params,
DeclEndLoc));
if (getSelLocsKind() != SelLoc_NonStandard)
- return setParamsAndSelLocs(C, Params, std::nullopt);
+ return setParamsAndSelLocs(C, Params, {});
setParamsAndSelLocs(C, Params, SelLocs);
}
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp
index 81ca48e60942d5..32c82f614d6f27 100644
--- a/clang/lib/AST/DeclOpenMP.cpp
+++ b/clang/lib/AST/DeclOpenMP.cpp
@@ -30,7 +30,7 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
SourceLocation L,
ArrayRef<Expr *> VL) {
auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>(
- C, DC, std::nullopt, VL.size(), L);
+ C, DC, {}, VL.size(), L);
D->setVars(VL);
return D;
}
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index d2d8907b884ec8..4a506b7be45642 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -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;
}
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 66db6263cb1bd2..bf2c1b92fa6b49 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4720,8 +4720,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
OK_Ordinary) {
BaseAndUpdaterExprs[0] = baseExpr;
- InitListExpr *ILE =
- new (C) InitListExpr(C, lBraceLoc, std::nullopt, rBraceLoc);
+ InitListExpr *ILE = new (C) InitListExpr(C, lBraceLoc, {}, rBraceLoc);
ILE->setType(baseExpr->getType());
BaseAndUpdaterExprs[1] = ILE;
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index 3931fcaa352961..dbc161347025c0 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -397,7 +397,7 @@ class MicrosoftCXXNameMangler {
void mangleBits(llvm::APInt Number);
void mangleTagTypeKind(TagTypeKind TK);
void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName,
- ArrayRef<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);
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp
index 5adfd919574603..4f441c2f92dc7f 100644
--- a/clang/lib/AST/StmtOpenMP.cpp
+++ b/clang/lib/AST/StmtOpenMP.cpp
@@ -452,8 +452,7 @@ OMPReverseDirective::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation EndLoc, Stmt *AssociatedStmt,
Stmt *TransformedStmt, Stmt *PreInits) {
OMPReverseDirective *Dir = createDirective<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);
}
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 127e843d4ead21..c5f35b35ad3579 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -542,7 +542,7 @@ static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) {
CallExpr *CE = CallExpr::Create(
/*ASTContext=*/C,
/*StmtClass=*/M.makeLvalueToRvalue(/*Expr=*/Block),
- /*Args=*/std::nullopt,
+ /*Args=*/{},
/*QualType=*/C.VoidTy,
/*ExprValueType=*/VK_PRValue,
/*SourceLocation=*/SourceLocation(), FPOptionsOverride());
@@ -610,7 +610,7 @@ static Stmt *create_dispatch_sync(ASTContext &C, const FunctionDecl *D) {
ASTMaker M(C);
DeclRefExpr *DR = M.makeDeclRefExpr(PV);
ImplicitCastExpr *ICE = M.makeLvalueToRvalue(DR, Ty);
- CallExpr *CE = CallExpr::Create(C, ICE, std::nullopt, C.VoidTy, VK_PRValue,
+ CallExpr *CE = CallExpr::Create(C, ICE, {}, C.VoidTy, VK_PRValue,
SourceLocation(), FPOptionsOverride());
return CE;
}
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 5e0ec9ecc92ea4..fad2f52e89ef14 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -3605,7 +3605,7 @@ class VariableGroupsManagerImpl : public VariableGroupsManager {
auto It = VarGrpMap.find(Var);
if (It == VarGrpMap.end())
- return std::nullopt;
+ return {};
return Groups[It->second];
}
diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h
index 94d9ba93ed226f..6edd3474d4edae 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -122,7 +122,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
ArrayRef<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)
diff --git a/clang/lib/Basic/Targets/ARC.h b/clang/lib/Basic/Targets/ARC.h
index fcbfdd6eec5862..7f3d0aa15ab81f 100644
--- a/clang/lib/Basic/Targets/ARC.h
+++ b/clang/lib/Basic/Targets/ARC.h
@@ -40,9 +40,7 @@ class LLVM_LIBRARY_VISIBILITY ARCTargetInfo : public TargetInfo {
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override;
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY ARCTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
bool validateAsmConstraint(const char *&Name,
diff --git a/clang/lib/Basic/Targets/AVR.h b/clang/lib/Basic/Targets/AVR.h
index 0a2f51747f8a7f..df1f8d171efbaa 100644
--- a/clang/lib/Basic/Targets/AVR.h
+++ b/clang/lib/Basic/Targets/AVR.h
@@ -63,9 +63,7 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo {
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override;
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override {
diff --git a/clang/lib/Basic/Targets/BPF.h b/clang/lib/Basic/Targets/BPF.h
index d19b37dd4df7a7..27a4b5f3149702 100644
--- a/clang/lib/Basic/Targets/BPF.h
+++ b/clang/lib/Basic/Targets/BPF.h
@@ -67,9 +67,7 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
}
bool isValidGCCRegisterName(StringRef Name) const override { return true; }
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
bool allowDebugInfoForExternalRef() const override { return true; }
diff --git a/clang/lib/Basic/Targets/DirectX.h b/clang/lib/Basic/Targets/DirectX.h
index 19b61252409b09..ab22d1281a4df7 100644
--- a/clang/lib/Basic/Targets/DirectX.h
+++ b/clang/lib/Basic/Targets/DirectX.h
@@ -72,15 +72,11 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo {
return Feature == "directx";
}
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/clang/lib/Basic/Targets/Lanai.h b/clang/lib/Basic/Targets/Lanai.h
index 144cbc7de98931..f7e439c7c9e1cf 100644
--- a/clang/lib/Basic/Targets/Lanai.h
+++ b/clang/lib/Basic/Targets/Lanai.h
@@ -78,9 +78,7 @@ class LLVM_LIBRARY_VISIBILITY LanaiTargetInfo : public TargetInfo {
return TargetInfo::VoidPtrBuiltinVaList;
}
- ArrayRef<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 {
diff --git a/clang/lib/Basic/Targets/M68k.cpp b/clang/lib/Basic/Targets/M68k.cpp
index 8b8bf97d6f99a1..b5b29fd8675630 100644
--- a/clang/lib/Basic/Targets/M68k.cpp
+++ b/clang/lib/Basic/Targets/M68k.cpp
@@ -117,7 +117,7 @@ void M68kTargetInfo::getTargetDefines(const LangOptions &Opts,
ArrayRef<Builtin::Info> M68kTargetInfo::getTargetBuiltins() const {
// FIXME: Implement.
- return std::nullopt;
+ return {};
}
bool M68kTargetInfo::hasFeature(StringRef Feature) const {
diff --git a/clang/lib/Basic/Targets/MSP430.h b/clang/lib/Basic/Targets/MSP430.h
index 25639b8c1e0ad9..2266ada25c1dd6 100644
--- a/clang/lib/Basic/Targets/MSP430.h
+++ b/clang/lib/Basic/Targets/MSP430.h
@@ -52,7 +52,7 @@ class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo {
ArrayRef<Builtin::Info> getTargetBuiltins() const override {
// FIXME: Implement.
- return std::nullopt;
+ return {};
}
bool allowsLargerPreferedTypeAlignment() const override { return false; }
diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h
index 1ef20ce733917d..165b28a60fb2a9 100644
--- a/clang/lib/Basic/Targets/NVPTX.h
+++ b/clang/lib/Basic/Targets/NVPTX.h
@@ -93,7 +93,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases.
- return std::nullopt;
+ return {};
}
bool validateAsmConstraint(const char *&Name,
diff --git a/clang/lib/Basic/Targets/PNaCl.cpp b/clang/lib/Basic/Targets/PNaCl.cpp
index 51b6452b0c2039..c4adfbefb9c73a 100644
--- a/clang/lib/Basic/Targets/PNaCl.cpp
+++ b/clang/lib/Basic/Targets/PNaCl.cpp
@@ -16,12 +16,10 @@
using namespace clang;
using namespace clang::targets;
-ArrayRef<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,
diff --git a/clang/lib/Basic/Targets/PNaCl.h b/clang/lib/Basic/Targets/PNaCl.h
index 595c4d83b1d1c3..7e0e10aa362d87 100644
--- a/clang/lib/Basic/Targets/PNaCl.h
+++ b/clang/lib/Basic/Targets/PNaCl.h
@@ -52,9 +52,7 @@ class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {
return Feature == "pnacl";
}
- ArrayRef<Builtin::Info> getTargetBuiltins() const override {
- return std::nullopt;
- }
+ ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::PNaClABIBuiltinVaList;
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index cc79562de2871e..30c7ac8d9c037f 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -159,15 +159,11 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo {
// memcpy as per section 3 of the SPIR spec.
bool useFP16ConversionIntrinsics() const override { return false; }
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/clang/lib/Basic/Targets/Sparc.h b/clang/lib/Basic/Targets/Sparc.h
index ee0d3e2b4329eb..9c529a5bc5e7fa 100644
--- a/clang/lib/Basic/Targets/Sparc.h
+++ b/clang/lib/Basic/Targets/Sparc.h
@@ -50,7 +50,7 @@ class LLVM_LIBRARY_VISIBILITY SparcTargetInfo : public TargetInfo {
ArrayRef<Builtin::Info> getTargetBuiltins() const override {
// FIXME: Implement!
- return std::nullopt;
+ return {};
}
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
diff --git a/clang/lib/Basic/Targets/SystemZ.h b/clang/lib/Basic/Targets/SystemZ.h
index f05ea473017bec..ef9a07033a6e4f 100644
--- a/clang/lib/Basic/Targets/SystemZ.h
+++ b/clang/lib/Basic/Targets/SystemZ.h
@@ -105,7 +105,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo {
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases.
- return std::nullopt;
+ return {};
}
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
diff --git a/clang/lib/Basic/Targets/TCE.h b/clang/lib/Basic/Targets/TCE.h
index dcf684fe6dbc01..d6280b02f07b25 100644
--- a/clang/lib/Basic/Targets/TCE.h
+++ b/clang/lib/Basic/Targets/TCE.h
@@ -95,9 +95,7 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }
- ArrayRef<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 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
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 @@ class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
};
diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h
index c8e93c79bb656f..6c2fe8049ff47a 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -124,10 +124,10 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
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,
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index a99ae62984c7d5..2affb659a160b6 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -210,7 +210,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
ArrayRef<const char *> getGCCRegNames() const override;
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
diff --git a/clang/lib/Basic/Targets/XCore.h b/clang/lib/Basic/Targets/XCore.h
index a58d3e8acf4791..84fd59d1a71e49 100644
--- a/clang/lib/Basic/Targets/XCore.h
+++ b/clang/lib/Basic/Targets/XCore.h
@@ -60,7 +60,7 @@ class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo : public TargetInfo {
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
- return std::nullopt;
+ return {};
}
bool validateAsmConstraint(const char *&Name,
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 3f28b7f26c36fe..e2d03eff8ab4a0 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2024,7 +2024,7 @@ Value *CodeGenFunction::EmitCheckedArgForBuiltin(const Expr *E,
SanitizerHandler::InvalidBuiltin,
{EmitCheckSourceLocation(E->getExprLoc()),
llvm::ConstantInt::get(Builder.getInt8Ty(), Kind)},
- std::nullopt);
+ {});
return ArgValue;
}
@@ -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
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 4ae981e4013e9c..5f50ab6f34ff8d 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -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.
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp
index 5d253c92a38a81..d9c0dbe45d6cf9 100644
--- a/clang/lib/CodeGen/CGCleanup.cpp
+++ b/clang/lib/CodeGen/CGCleanup.cpp
@@ -1329,8 +1329,7 @@ static void EmitSehScope(CodeGenFunction &CGF,
CGF.getBundlesForFunclet(SehCppScope.getCallee());
if (CGF.CurrentFuncletPad)
BundleList.emplace_back("funclet", CGF.CurrentFuncletPad);
- CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, std::nullopt,
- BundleList);
+ CGF.Builder.CreateInvoke(SehCppScope, Cont, InvokeDest, {}, BundleList);
CGF.EmitBlock(Cont);
}
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 06015a9e541ea2..27bbbfc6f531a1 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2642,7 +2642,7 @@ void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
return;
llvm::MDNode *node;
if (AllocatedTy->isVoidType())
- node = llvm::MDNode::get(CGM.getLLVMContext(), std::nullopt);
+ node = llvm::MDNode::get(CGM.getLLVMContext(), {});
else
node = getOrCreateType(AllocatedTy, getOrCreateFile(Loc));
@@ -4324,8 +4324,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
!CGM.getCodeGenOpts().EmitCodeView))
// Create fake but valid subroutine type. Otherwise -verify would fail, and
// subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields.
- return DBuilder.createSubroutineType(
- DBuilder.getOrCreateTypeArray(std::nullopt));
+ return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray({}));
if (const auto *Method = dyn_cast<CXXMethodDecl>(D))
return getOrCreateMethodType(Method, F);
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 1e8ffb53b53a09..e0ea65bcaf3637 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2042,7 +2042,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) {
Load->setMetadata(llvm::LLVMContext::MD_range, RangeInfo);
Load->setMetadata(llvm::LLVMContext::MD_noundef,
- llvm::MDNode::get(getLLVMContext(), std::nullopt));
+ llvm::MDNode::get(getLLVMContext(), {}));
}
return EmitFromMemory(Load, Ty);
@@ -3375,9 +3375,9 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
// Format the type name as if for a diagnostic, including quotes and
// optionally an 'aka'.
SmallString<32> Buffer;
- CGM.getDiags().ConvertArgToString(
- DiagnosticsEngine::ak_qualtype, (intptr_t)T.getAsOpaquePtr(), StringRef(),
- StringRef(), std::nullopt, Buffer, std::nullopt);
+ CGM.getDiags().ConvertArgToString(DiagnosticsEngine::ak_qualtype,
+ (intptr_t)T.getAsOpaquePtr(), StringRef(),
+ StringRef(), {}, Buffer, {});
if (IsBitInt) {
// The Structure is: 0 to end the string, 32 bit unsigned integer in target
@@ -3884,7 +3884,7 @@ void CodeGenFunction::EmitUnreachable(SourceLocation Loc) {
EmitCheck(std::make_pair(static_cast<llvm::Value *>(Builder.getFalse()),
SanitizerKind::Unreachable),
SanitizerHandler::BuiltinUnreachable,
- EmitCheckSourceLocation(Loc), std::nullopt);
+ EmitCheckSourceLocation(Loc), {});
}
Builder.CreateUnreachable();
}
diff --git a/clang/lib/CodeGen/CGLoopInfo.cpp b/clang/lib/CodeGen/CGLoopInfo.cpp
index 6b886bd6b6d2cf..cdff7e50c4ee71 100644
--- a/clang/lib/CodeGen/CGLoopInfo.cpp
+++ b/clang/lib/CodeGen/CGLoopInfo.cpp
@@ -506,7 +506,7 @@ LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs,
Attrs.CodeAlign == 0 && !StartLoc && !EndLoc && !Attrs.MustProgress)
return;
- TempLoopID = MDNode::getTemporary(Header->getContext(), std::nullopt);
+ TempLoopID = MDNode::getTemporary(Header->getContext(), {});
}
void LoopInfo::finish() {
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index a73a71f2d26889..28da353ff2d78d 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -140,7 +140,7 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc());
cast<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(), {}));
}
}
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 6280e9465ecba6..7a07284f8a8aa5 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -69,7 +69,7 @@ class LazyRuntimeFunction {
FTy = llvm::FunctionType::get(RetTy, ArgTys, false);
}
else {
- FTy = llvm::FunctionType::get(RetTy, std::nullopt, false);
+ FTy = llvm::FunctionType::get(RetTy, {}, false);
}
}
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 30f3911a8b03c2..1c16d273a55357 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -7191,7 +7191,7 @@ CGObjCNonFragileABIMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
if (IsIvarOffsetKnownIdempotent(CGF, Ivar))
cast<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;
}
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 5e9f89b18918d2..c0931e82d9875a 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -5075,7 +5075,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
};
RegionCodeGenTy RCG(CodeGen);
CommonActionTy Action(
- nullptr, std::nullopt,
+ nullptr, {},
OMPBuilder.getOrCreateRuntimeFunction(
CGM.getModule(), WithNowait ? OMPRTL___kmpc_end_reduce_nowait
: OMPRTL___kmpc_end_reduce),
@@ -5197,7 +5197,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
ThreadId, // i32 <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 @@ class MappableExprsHandler {
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 @@ class MappableExprsHandler {
// for map(to: lambda): using user specified map type.
return getMapTypeBits(
I->getSecond()->getMapType(), I->getSecond()->getMapTypeModifiers(),
- /*MotionModifiers=*/std::nullopt, I->getSecond()->isImplicit(),
+ /*MotionModifiers=*/{}, I->getSecond()->isImplicit(),
/*AddPtrFlag=*/false,
/*AddIsTargetParamFlag=*/false,
/*isNonContiguous=*/false);
@@ -7818,7 +7818,7 @@ class MappableExprsHandler {
for (const auto L : C->component_lists()) {
const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr;
InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(),
- C->getMapTypeModifiers(), std::nullopt,
+ C->getMapTypeModifiers(), {},
/*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L),
E);
++EI;
@@ -7834,7 +7834,7 @@ class MappableExprsHandler {
Kind = Present;
const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) {
- InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_to, std::nullopt,
+ InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_to, {},
C->getMotionModifiers(), /*ReturnDevicePointer=*/false,
C->isImplicit(), std::get<2>(L), *EI);
++EI;
@@ -7850,8 +7850,8 @@ class MappableExprsHandler {
Kind = Present;
const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) {
- InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from,
- std::nullopt, C->getMotionModifiers(),
+ InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, {},
+ C->getMotionModifiers(),
/*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L),
*EI);
++EI;
@@ -7903,9 +7903,9 @@ class MappableExprsHandler {
// processed. Nonetheless, generateInfoForComponentList must be
// called to take the pointer into account for the calculation of
// the range of the partial struct.
- InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, std::nullopt,
- std::nullopt, /*ReturnDevicePointer=*/false, IsImplicit,
- nullptr, nullptr, IsDevAddr);
+ InfoGen(nullptr, Other, Components, OMPC_MAP_unknown, {}, {},
+ /*ReturnDevicePointer=*/false, IsImplicit, nullptr, nullptr,
+ IsDevAddr);
DeferredInfo[nullptr].emplace_back(IE, VD, IsDevAddr);
} else {
llvm::Value *Ptr;
@@ -8056,7 +8056,7 @@ class MappableExprsHandler {
CurInfo, StructBaseCurInfo, PartialStruct,
/*IsFirstComponentList=*/false, L.IsImplicit,
/*GenerateAllInfoForClauses*/ true, L.Mapper, L.ForDeviceAddr, VD,
- L.VarRef, /*OverlappedElements*/ std::nullopt,
+ L.VarRef, /*OverlappedElements*/ {},
HasMapBasePtr && HasMapArraySec);
// If this entry relates to a device pointer, set the relevant
@@ -8692,7 +8692,7 @@ class MappableExprsHandler {
ArrayRef<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 @@ class MappableExprsHandler {
auto It = OverlappedData.find(&L);
if (It == OverlappedData.end())
generateInfoForComponentList(
- MapType, MapModifiers, std::nullopt, Components, CombinedInfo,
+ MapType, MapModifiers, {}, Components, CombinedInfo,
StructBaseCombinedInfo, PartialStruct, IsFirstComponentList,
IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper,
/*ForDeviceAddr=*/false, VD, VarRef,
- /*OverlappedElements*/ std::nullopt,
- HasMapBasePtr && HasMapArraySec);
+ /*OverlappedElements*/ {}, HasMapBasePtr && HasMapArraySec);
IsFirstComponentList = false;
}
}
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index f65314d014c087..5e7715743afb58 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -352,7 +352,7 @@ class CGOpenMPRuntime {
/// Emits \p Callee function call with arguments \p Args with location \p Loc.
void emitCall(CodeGenFunction &CGF, SourceLocation Loc,
llvm::FunctionCallee Callee,
- ArrayRef<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 @@ class CGOpenMPRuntime {
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.
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 2e5ab6e7b9ac5c..c66d5d11b0bbfa 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -985,8 +985,8 @@ llvm::Function *CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(
getDistributeLastprivateVars(CGM.getContext(), D, LastPrivatesReductions);
if (!LastPrivatesReductions.empty()) {
GlobalizedRD = ::buildRecordForGlobalizedVars(
- CGM.getContext(), std::nullopt, LastPrivatesReductions,
- MappedDeclsFields, WarpSize);
+ CGM.getContext(), {}, LastPrivatesReductions, MappedDeclsFields,
+ WarpSize);
}
} else if (!LastPrivatesReductions.empty()) {
assert(!TeamAndReductions.first &&
@@ -1681,7 +1681,7 @@ void CGOpenMPRuntimeGPU::emitReduction(
++Cnt;
}
const RecordDecl *ReductionRec = ::buildRecordForGlobalizedVars(
- CGM.getContext(), PrivatesReductions, std::nullopt, VarFieldMap, 1);
+ CGM.getContext(), PrivatesReductions, {}, VarFieldMap, 1);
if (TeamsReduction)
TeamsReductions.push_back(ReductionRec);
@@ -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) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
index 4d586ec972f8d6..b59f43a6915ddf 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
@@ -294,9 +294,10 @@ class CGOpenMPRuntimeGPU : public CGOpenMPRuntime {
/// Emits call of the outlined function with the provided arguments,
/// translating these arguments to correct target-specific arguments.
- void emitOutlinedFunctionCall(
- CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn,
- ArrayRef<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.
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 71a27d0c6bc1fb..0da7855ab05c6c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -501,7 +501,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
FunctionDecl *DebugFunctionDecl = nullptr;
if (!FO.UIntPtrCastRequired) {
FunctionProtoType::ExtProtoInfo EPI;
- QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, std::nullopt, EPI);
+ QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, {}, EPI);
DebugFunctionDecl = FunctionDecl::Create(
Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(),
SourceLocation(), DeclarationName(), FunctionTy,
@@ -5509,7 +5509,7 @@ void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) {
if (const auto *FlushClause = S.getSingleClause<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;
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 465dc8c661af5c..573ced0857d5f5 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1595,7 +1595,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
llvm::Value *IsFalse = Builder.getFalse();
EmitCheck(std::make_pair(IsFalse, SanitizerKind::Return),
SanitizerHandler::MissingReturn,
- EmitCheckSourceLocation(FD->getLocation()), std::nullopt);
+ EmitCheckSourceLocation(FD->getLocation()), {});
} else if (ShouldEmitUnreachable) {
if (CGM.getCodeGenOpts().OptimizationLevel == 0)
EmitTrapCall(llvm::Intrinsic::trap);
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 5f203fe0b128b5..750a6cc24badca 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3524,7 +3524,7 @@ class CodeGenFunction : public CodeGenTypeCache {
/// This function may clear the current insertion point; callers should use
/// EnsureInsertPoint if they wish to subsequently generate code without first
/// calling EmitBlock, EmitBranch, or EmitStmt.
- void EmitStmt(const Stmt *S, ArrayRef<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 @@ class CodeGenFunction : public CodeGenTypeCache {
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 @@ class CodeGenFunction : public CodeGenTypeCache {
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 {
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 1b77490e261c21..8d5787769382f6 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -753,8 +753,7 @@ class CodeGenModule : public CodeGenTypeCache {
llvm::MDNode *getNoObjCARCExceptionsMetadata() {
if (!NoObjCARCExceptionsMetadata)
- NoObjCARCExceptionsMetadata =
- llvm::MDNode::get(getLLVMContext(), std::nullopt);
+ NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), {});
return NoObjCARCExceptionsMetadata;
}
@@ -1181,8 +1180,7 @@ class CodeGenModule : public CodeGenTypeCache {
llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD,
unsigned BuiltinID);
- llvm::Function *getIntrinsic(unsigned IID,
- ArrayRef<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);
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 0a63c50d44f4b7..45518736a2ac38 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -649,7 +649,7 @@ struct EmptyCoverageMappingBuilder : public CoverageMappingBuilder {
if (MappingRegions.empty())
return;
- CoverageMappingWriter Writer(FileIDMapping, std::nullopt, MappingRegions);
+ CoverageMappingWriter Writer(FileIDMapping, {}, MappingRegions);
Writer.write(OS);
}
};
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 89f9457523824a..9b3c2f1b2af677 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1416,7 +1416,7 @@ void ItaniumCXXABI::emitRethrow(CodeGenFunction &CGF, bool isNoReturn) {
llvm::FunctionCallee Fn = CGM.CreateRuntimeFunction(FTy, "__cxa_rethrow");
if (isNoReturn)
- CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, std::nullopt);
+ CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, {});
else
CGF.EmitRuntimeCallOrInvoke(Fn);
}
diff --git a/clang/lib/Frontend/DiagnosticRenderer.cpp b/clang/lib/Frontend/DiagnosticRenderer.cpp
index 017ce1c17d5c9a..8b32af13372579 100644
--- a/clang/lib/Frontend/DiagnosticRenderer.cpp
+++ b/clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -146,7 +146,7 @@ void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) {
void DiagnosticRenderer::emitBasicNote(StringRef Message) {
emitDiagnosticMessage(FullSourceLoc(), PresumedLoc(), DiagnosticsEngine::Note,
- Message, std::nullopt, DiagOrStoredDiag());
+ Message, {}, DiagOrStoredDiag());
}
/// Prints an include stack when appropriate for a particular
@@ -451,7 +451,7 @@ void DiagnosticRenderer::emitSingleMacroExpansion(
Message << "expanded from macro '" << MacroName << "'";
emitDiagnostic(SpellingLoc, DiagnosticsEngine::Note, Message.str(),
- SpellingRanges, std::nullopt);
+ SpellingRanges, {});
}
/// Check that the macro argument location of Loc starts with ArgumentLoc.
diff --git a/clang/lib/Index/IndexingContext.h b/clang/lib/Index/IndexingContext.h
index 89363b529fe99a..3020b33bea3857 100644
--- a/clang/lib/Index/IndexingContext.h
+++ b/clang/lib/Index/IndexingContext.h
@@ -68,17 +68,17 @@ class IndexingContext {
static bool isTemplateImplicitInstantiation(const Decl *D);
bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(),
- ArrayRef<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 @@ class IndexingContext {
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,
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index fd6bc17ae9cdac..0a02a63deba3dc 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -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;
}
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index d48bb8a9a9cded..3eef3dc9b0f344 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -286,8 +286,8 @@ void Preprocessor::dumpMacroInfo(const IdentifierInfo *II) {
// Dump module macros.
llvm::DenseSet<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);
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 122a05be1c039a..31984453487aef 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -2445,8 +2445,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
// Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
- std::nullopt, LAngleLoc, nullptr));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
+ LAngleLoc, nullptr));
TheDecl = ParseFunctionDefinition(
D,
@@ -2787,8 +2787,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
// Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
- std::nullopt, LAngleLoc, nullptr));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
+ LAngleLoc, nullptr));
ThisDecl =
Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D);
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index b28c2a9db91b0f..60aab1411a96c5 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -2220,8 +2220,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// "template<>", so that we treat this construct as a class
// template specialization.
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc,
- std::nullopt, LAngleLoc, nullptr));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, {},
+ LAngleLoc, nullptr));
TemplateParams = &FakedParamLists;
}
}
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 2fb4be0035b667..4570a18bc0d5e5 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -3855,8 +3855,8 @@ ExprResult Parser::ParseBlockLiteralExpression() {
/*NumExceptions=*/0,
/*NoexceptExpr=*/nullptr,
/*ExceptionSpecTokens=*/nullptr,
- /*DeclsInPrototype=*/std::nullopt,
- CaretLoc, CaretLoc, ParamInfo),
+ /*DeclsInPrototype=*/{}, CaretLoc,
+ CaretLoc, ParamInfo),
CaretLoc);
MaybeParseGNUAttributes(ParamInfo);
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index e96cddf88a1346..ce3624f366a2a1 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -1579,9 +1579,8 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
DynamicExceptionRanges.data(), DynamicExceptions.size(),
NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr,
/*ExceptionSpecTokens*/ nullptr,
- /*DeclsInPrototype=*/std::nullopt, LParenLoc,
- FunLocalRangeEnd, D, TrailingReturnType,
- TrailingReturnTypeLoc, &DS),
+ /*DeclsInPrototype=*/{}, LParenLoc, FunLocalRangeEnd, D,
+ TrailingReturnType, TrailingReturnTypeLoc, &DS),
std::move(Attributes), DeclEndLoc);
// We have called ActOnLambdaClosureQualifiers for parentheses-less cases
diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp
index dd59cb23236d74..07f133408c3879 100644
--- a/clang/lib/Parse/ParseInit.cpp
+++ b/clang/lib/Parse/ParseInit.cpp
@@ -487,7 +487,7 @@ ExprResult Parser::ParseBraceInitializer() {
: diag::ext_c_empty_initializer);
}
// Match the '}'.
- return Actions.ActOnInitList(LBraceLoc, std::nullopt, ConsumeBrace());
+ return Actions.ActOnInitList(LBraceLoc, {}, ConsumeBrace());
}
// Enter an appropriate expression evaluation context for an initializer list.
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index dad39d8dc736de..28ccd3061f8433 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -3227,13 +3227,13 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
cutOffParsing();
if (SuperLoc.isValid())
Actions.CodeCompletion().CodeCompleteObjCSuperMessage(
- getCurScope(), SuperLoc, std::nullopt, false);
+ getCurScope(), SuperLoc, {}, false);
else if (ReceiverType)
Actions.CodeCompletion().CodeCompleteObjCClassMessage(
- getCurScope(), ReceiverType, std::nullopt, false);
+ getCurScope(), ReceiverType, {}, false);
else
Actions.CodeCompletion().CodeCompleteObjCInstanceMessage(
- getCurScope(), ReceiverExpr, std::nullopt, false);
+ getCurScope(), ReceiverExpr, {}, false);
return ExprError();
}
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 108b532be41689..16f731174fd0e1 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2561,7 +2561,7 @@ StmtResult Parser::ParseOpenMPExecutableDirective(
DKind == OMPD_target_exit_data) {
Actions.OpenMP().ActOnOpenMPRegionStart(DKind, getCurScope());
AssociatedStmt = (Sema::CompoundScopeRAII(Actions),
- Actions.ActOnCompoundStmt(Loc, Loc, std::nullopt,
+ Actions.ActOnCompoundStmt(Loc, Loc, {},
/*isStmtExpr=*/false));
AssociatedStmt =
Actions.OpenMP().ActOnOpenMPRegionEnd(AssociatedStmt, Clauses);
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 60d647da48f053..7d727efb228731 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -2558,8 +2558,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions);
- FnBody =
- Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
+ FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
}
BodyScope.Exit();
@@ -2596,8 +2595,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
// compound statement as the body.
if (FnBody.isInvalid()) {
Sema::CompoundScopeRAII CompoundScope(Actions);
- FnBody =
- Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, std::nullopt, false);
+ FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, {}, false);
}
BodyScope.Exit();
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 5e9886a109468f..2b51765e80864a 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -2536,8 +2536,8 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
// with default arguments, etc.
if (IsMemExpr && !E.isTypeDependent()) {
Sema::TentativeAnalysisScope Trap(*this);
- ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(),
- std::nullopt, SourceLocation());
+ ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(), {},
+ SourceLocation());
if (R.isUsable()) {
ZeroArgCallReturnTy = R.get()->getType();
return true;
@@ -2689,7 +2689,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
// FIXME: Try this before emitting the fixit, and suppress diagnostics
// while doing so.
- E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), std::nullopt,
+ E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), {},
Range.getEnd().getLocWithOffset(1));
return true;
}
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 2bcb930acdcb57..27b274d74ce716 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6300,7 +6300,7 @@ class CheckFormatHandler : public analyze_format_string::FormatStringHandler {
EmitFormatDiagnostic(Sema &S, bool inFunctionCall, const Expr *ArgumentExpr,
const PartialDiagnostic &PDiag, SourceLocation StringLoc,
bool IsStringLocation, Range StringRange,
- ArrayRef<FixItHint> Fixit = std::nullopt);
+ ArrayRef<FixItHint> Fixit = {});
protected:
bool HandleInvalidConversionSpecifier(unsigned argIndex, SourceLocation Loc,
@@ -6327,7 +6327,7 @@ class CheckFormatHandler : public analyze_format_string::FormatStringHandler {
template <typename Range>
void EmitFormatDiagnostic(PartialDiagnostic PDiag, SourceLocation StringLoc,
bool IsStringLocation, Range StringRange,
- ArrayRef<FixItHint> Fixit = std::nullopt);
+ ArrayRef<FixItHint> Fixit = {});
};
} // namespace
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 3e31f3d82657a3..16a76ff9b5c241 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4567,8 +4567,7 @@ void SemaCodeCompletion::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
0) {
ParsedType T = DS.getRepAsType();
if (!T.get().isNull() && T.get()->isObjCObjectOrInterfaceType())
- AddClassMessageCompletions(SemaRef, S, T, std::nullopt, false, false,
- Results);
+ AddClassMessageCompletions(SemaRef, S, T, {}, false, false, Results);
}
// Note that we intentionally suppress macro results here, since we do not
@@ -4931,7 +4930,7 @@ void SemaCodeCompletion::CodeCompletePostfixExpression(Scope *S, ExprResult E,
if (E.isInvalid())
CodeCompleteExpression(S, PreferredType);
else if (getLangOpts().ObjC)
- CodeCompleteObjCInstanceMessage(S, E.get(), std::nullopt, false);
+ CodeCompleteObjCInstanceMessage(S, E.get(), {}, false);
}
/// The set of properties that have already been added, referenced by
@@ -7747,8 +7746,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertyGetter(Scope *S) {
Results.EnterNewScope();
VisitedSelectorSet Selectors;
- AddObjCMethods(Class, true, MK_ZeroArgSelector, std::nullopt,
- SemaRef.CurContext, Selectors,
+ AddObjCMethods(Class, true, MK_ZeroArgSelector, {}, SemaRef.CurContext,
+ Selectors,
/*AllowSameLength=*/true, Results);
Results.ExitScope();
HandleCodeCompleteResults(&SemaRef, CodeCompleter,
@@ -7776,8 +7775,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySetter(Scope *S) {
Results.EnterNewScope();
VisitedSelectorSet Selectors;
- AddObjCMethods(Class, true, MK_OneArgSelector, std::nullopt,
- SemaRef.CurContext, Selectors,
+ AddObjCMethods(Class, true, MK_OneArgSelector, {}, SemaRef.CurContext,
+ Selectors,
/*AllowSameLength=*/true, Results);
Results.ExitScope();
@@ -8075,8 +8074,7 @@ void SemaCodeCompletion::CodeCompleteObjCMessageReceiver(Scope *S) {
if (Iface->getSuperClass()) {
Results.AddResult(Result("super"));
- AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, std::nullopt,
- Results);
+ AddSuperSendCompletion(SemaRef, /*NeedSuperKeyword=*/true, {}, Results);
}
if (getLangOpts().CPlusPlus11)
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 89a0beadc61f3d..3724aaf804c905 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -341,7 +341,7 @@ static Expr *maybeTailCall(Sema &S, QualType RetType, Expr *E,
// EvaluateBinaryTypeTrait(BTT_IsConvertible, ...) which is at the moment
// a private function in SemaExprCXX.cpp
- ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", std::nullopt);
+ ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", {});
if (AddressExpr.isInvalid())
return nullptr;
@@ -392,8 +392,8 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise,
return Result.get();
};
- CallExpr *AwaitReady = cast_or_null<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;
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 229c9080d558ec..25061f02c13f6c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14135,8 +14135,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
InitializationKind Kind
= InitializationKind::CreateDefault(Var->getLocation());
- InitializationSequence InitSeq(*this, Entity, Kind, std::nullopt);
- ExprResult Init = InitSeq.Perform(*this, Entity, Kind, std::nullopt);
+ InitializationSequence InitSeq(*this, Entity, Kind, {});
+ ExprResult Init = InitSeq.Perform(*this, Entity, Kind, {});
if (Init.get()) {
Var->setInit(MaybeCreateExprWithCleanups(Init.get()));
@@ -16428,8 +16428,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
/*NumExceptions=*/0,
/*NoexceptExpr=*/nullptr,
/*ExceptionSpecTokens=*/nullptr,
- /*DeclsInPrototype=*/std::nullopt,
- Loc, Loc, D),
+ /*DeclsInPrototype=*/{}, Loc, Loc,
+ D),
std::move(DS.getAttributes()), SourceLocation());
D.SetIdentifier(&II, Loc);
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 43ec25b23d972a..1a691c0e1689d6 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1281,7 +1281,7 @@ static bool checkTupleLikeDecomposition(Sema &S,
if (E.isInvalid())
return true;
- E = S.BuildCallExpr(nullptr, E.get(), Loc, std::nullopt, Loc);
+ E = S.BuildCallExpr(nullptr, E.get(), Loc, {}, Loc);
} else {
// Otherwise, the initializer is get<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())
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index d8cd09b8272930..78acfeddb78639 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -5511,10 +5511,9 @@ void SemaObjC::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
InitializationKind InitKind =
InitializationKind::CreateDefault(ObjCImplementation->getLocation());
- InitializationSequence InitSeq(SemaRef, InitEntity, InitKind,
- std::nullopt);
+ InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
ExprResult MemberInit =
- InitSeq.Perform(SemaRef, InitEntity, InitKind, std::nullopt);
+ InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
// Note, MemberInit could actually come back empty if no initialization
// is required (e.g., because it would call a trivial default constructor)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 6807f44562f6ca..ff6616901016ab 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1079,8 +1079,8 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
if (TrapFn.isInvalid())
return ExprError();
- ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(),
- std::nullopt, E->getEndLoc());
+ ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), {},
+ E->getEndLoc());
if (Call.isInvalid())
return ExprError();
@@ -2164,8 +2164,8 @@ Sema::ActOnStringLiteral(ArrayRef<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,
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 2f914ddc22a38b..35fbc4e7c30ebb 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -305,7 +305,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(SemaObjC &S, SourceLocation Loc,
ParmVarDecl::Create(S.SemaRef.Context, Method, SourceLocation(),
SourceLocation(), &CX.Idents.get("value"),
NumberType, /*TInfo=*/nullptr, SC_None, nullptr);
- Method->setMethodParams(S.SemaRef.Context, value, std::nullopt);
+ Method->setMethodParams(S.SemaRef.Context, value, {});
}
if (!validateBoxingMethod(S.SemaRef, Loc, S.NSNumberDecl, Sel, Method))
@@ -588,7 +588,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
Context.getPointerType(ConstCharType),
/*TInfo=*/nullptr,
SC_None, nullptr);
- M->setMethodParams(Context, value, std::nullopt);
+ M->setMethodParams(Context, value, {});
BoxingMethod = M;
}
@@ -713,7 +713,7 @@ ExprResult SemaObjC::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
SC_None, nullptr);
Params.push_back(type);
- M->setMethodParams(Context, Params, std::nullopt);
+ M->setMethodParams(Context, Params, {});
BoxingMethod = M;
}
@@ -843,7 +843,7 @@ ExprResult SemaObjC::BuildObjCArrayLiteral(SourceRange SR,
/*TInfo=*/nullptr, SC_None,
nullptr);
Params.push_back(cnt);
- Method->setMethodParams(Context, Params, std::nullopt);
+ Method->setMethodParams(Context, Params, {});
}
if (!validateBoxingMethod(SemaRef, Loc, NSArrayDecl, Sel, Method))
@@ -1012,7 +1012,7 @@ ExprResult SemaObjC::BuildObjCDictionaryLiteral(
/*TInfo=*/nullptr, SC_None,
nullptr);
Params.push_back(cnt);
- Method->setMethodParams(Context, Params, std::nullopt);
+ Method->setMethodParams(Context, Params, {});
}
if (!validateBoxingMethod(SemaRef, SR.getBegin(), NSDictionaryDecl, Sel,
@@ -4388,7 +4388,7 @@ bool SemaObjC::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
ExprResult msg = BuildInstanceMessageImplicit(
SrcExpr, SrcType, InstanceMethod->getLocation(),
- InstanceMethod->getSelector(), InstanceMethod, std::nullopt);
+ InstanceMethod->getSelector(), InstanceMethod, {});
SrcExpr = msg.get();
}
return true;
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index f560865681fa5a..573e90aced3eea 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -569,7 +569,7 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc,
true);
MultiExprArg SubInit;
Expr *InitExpr;
- InitListExpr DummyInitList(SemaRef.Context, Loc, std::nullopt, Loc);
+ InitListExpr DummyInitList(SemaRef.Context, Loc, {}, Loc);
// C++ [dcl.init.aggr]p7:
// If there are fewer initializer-clauses in the list than there are
@@ -588,10 +588,9 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc,
//
// Only do this if we're initializing a class type, to avoid filling in
// the initializer list where possible.
- InitExpr = VerifyOnly
- ? &DummyInitList
- : new (SemaRef.Context)
- InitListExpr(SemaRef.Context, Loc, std::nullopt, Loc);
+ InitExpr = VerifyOnly ? &DummyInitList
+ : new (SemaRef.Context)
+ InitListExpr(SemaRef.Context, Loc, {}, Loc);
InitExpr->setType(SemaRef.Context.VoidTy);
SubInit = InitExpr;
Kind = InitializationKind::CreateCopy(Loc, Loc);
@@ -3403,7 +3402,7 @@ InitListChecker::createInitListExpr(QualType CurrentObjectType,
SourceRange InitRange,
unsigned ExpectedNumInits) {
InitListExpr *Result = new (SemaRef.Context) InitListExpr(
- SemaRef.Context, InitRange.getBegin(), std::nullopt, InitRange.getEnd());
+ SemaRef.Context, InitRange.getBegin(), {}, InitRange.getEnd());
QualType ResultType = CurrentObjectType;
if (!ResultType->isArrayType())
@@ -5650,7 +5649,7 @@ static void TryDefaultInitialization(Sema &S,
// constructor for T is called (and the initialization is ill-formed if
// T has no accessible default constructor);
if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) {
- TryConstructorInitialization(S, Entity, Kind, std::nullopt, DestType,
+ TryConstructorInitialization(S, Entity, Kind, {}, DestType,
Entity.getType(), Sequence);
return;
}
@@ -5687,11 +5686,13 @@ static void TryOrBuildParenListInitialization(
const InitializationKind &SubKind,
Expr *Arg, Expr **InitExpr = nullptr) {
InitializationSequence IS = InitializationSequence(
- S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt);
+ S, SubEntity, SubKind,
+ Arg ? MultiExprArg(Arg) : MutableArrayRef<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;
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 7b9d5f4ff7eb34..e7afa0f4c81fc4 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -909,8 +909,8 @@ getDummyLambdaType(Sema &S, SourceLocation Loc = SourceLocation()) {
QualType DefaultTypeForNoTrailingReturn = S.getLangOpts().CPlusPlus14
? S.Context.getAutoDeductType()
: S.Context.DependentTy;
- QualType MethodTy = S.Context.getFunctionType(DefaultTypeForNoTrailingReturn,
- std::nullopt, EPI);
+ QualType MethodTy =
+ S.Context.getFunctionType(DefaultTypeForNoTrailingReturn, {}, EPI);
return S.Context.getTrivialTypeSourceInfo(MethodTy, Loc);
}
@@ -1681,8 +1681,7 @@ static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange,
ConvExtInfo.TypeQuals = Qualifiers();
ConvExtInfo.TypeQuals.addConst();
ConvExtInfo.ExceptionSpec.Type = EST_BasicNoexcept;
- QualType ConvTy =
- S.Context.getFunctionType(PtrToFunctionTy, std::nullopt, ConvExtInfo);
+ QualType ConvTy = S.Context.getFunctionType(PtrToFunctionTy, {}, ConvExtInfo);
SourceLocation Loc = IntroducerRange.getBegin();
DeclarationName ConversionName
@@ -1864,8 +1863,7 @@ static void addBlockPointerConversion(Sema &S,
/*IsVariadic=*/false, /*IsCXXMethod=*/true));
ConversionEPI.TypeQuals = Qualifiers();
ConversionEPI.TypeQuals.addConst();
- QualType ConvTy =
- S.Context.getFunctionType(BlockPtrTy, std::nullopt, ConversionEPI);
+ QualType ConvTy = S.Context.getFunctionType(BlockPtrTy, {}, ConversionEPI);
SourceLocation Loc = IntroducerRange.getBegin();
DeclarationName Name
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index e5db11369221a4..8468e9a730c2d0 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -1200,7 +1200,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_C);
EPI.ExceptionSpec = EST_None;
QualType ExpectedType = R.getSema().Context.getFunctionType(
- R.getLookupName().getCXXNameType(), std::nullopt, EPI);
+ R.getLookupName().getCXXNameType(), {}, EPI);
// Perform template argument deduction against the type that we would
// expect the function to have.
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 031f2a6af87744..5c4dc93ff16cdf 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -2552,7 +2552,7 @@ void SemaObjC::ProcessPropertyDecl(ObjCPropertyDecl *property) {
/*TInfo=*/nullptr,
SC_None,
nullptr);
- SetterMethod->setMethodParams(Context, Argument, std::nullopt);
+ SetterMethod->setMethodParams(Context, Argument, {});
AddPropertyAttrs(SemaRef, SetterMethod, property);
diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp
index d33b0d0c1c3018..aadcd7183e713b 100644
--- a/clang/lib/Sema/SemaOpenACC.cpp
+++ b/clang/lib/Sema/SemaOpenACC.cpp
@@ -1986,8 +1986,7 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc,
// Fill in a dummy 'length' so that when we instantiate this we don't
// double-diagnose here.
ExprResult Recovery = SemaRef.CreateRecoveryExpr(
- ColonLoc, SourceLocation(), ArrayRef<Expr *>{std::nullopt},
- Context.IntTy);
+ ColonLoc, SourceLocation(), ArrayRef<Expr *>(), Context.IntTy);
Length = Recovery.isUsable() ? Recovery.get() : nullptr;
}
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index fa81fc42c0ee53..79e1536288e602 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -15901,9 +15901,9 @@ OMPClause *SemaOpenMP::ActOnOpenMPSimpleClause(
return Res;
}
-static std::string
-getListOfPossibleValues(OpenMPClauseKind K, unsigned First, unsigned Last,
- ArrayRef<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) &&
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 7b86299561a365..4aeceba128b29b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -5502,7 +5502,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
}
if (CT->getSize().ugt(e)) {
// Need an init from empty {}, is there one?
- InitListExpr EmptyList(S.Context, From->getEndLoc(), std::nullopt,
+ InitListExpr EmptyList(S.Context, From->getEndLoc(), {},
From->getEndLoc());
EmptyList.setType(S.Context.VoidTy);
DfltElt = TryListConversion(
@@ -7479,7 +7479,7 @@ void Sema::AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType,
} else {
AddMethodCandidate(cast<CXXMethodDecl>(Decl), FoundDecl, ActingContext,
ObjectType, ObjectClassification, Args, CandidateSet,
- SuppressUserConversions, false, std::nullopt, PO);
+ SuppressUserConversions, false, {}, PO);
}
}
@@ -8125,7 +8125,7 @@ void Sema::AddConversionCandidate(
}
if (EnableIfAttr *FailedAttr =
- CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) {
+ CheckEnableIf(Conversion, CandidateSet.getLocation(), {})) {
Candidate.Viable = false;
Candidate.FailureKind = ovl_fail_enable_if;
Candidate.DeductionFailure.Data = FailedAttr;
@@ -8306,7 +8306,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
}
if (EnableIfAttr *FailedAttr =
- CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) {
+ CheckEnableIf(Conversion, CandidateSet.getLocation(), {})) {
Candidate.Viable = false;
Candidate.FailureKind = ovl_fail_enable_if;
Candidate.DeductionFailure.Data = FailedAttr;
@@ -8346,10 +8346,10 @@ void Sema::AddNonMemberOperatorCandidates(
continue;
AddOverloadCandidate(FD, F.getPair(), FunctionArgs, CandidateSet);
if (CandidateSet.getRewriteInfo().shouldAddReversed(*this, Args, FD))
- AddOverloadCandidate(
- FD, F.getPair(), {FunctionArgs[1], FunctionArgs[0]}, CandidateSet,
- false, false, true, false, ADLCallKind::NotADL, std::nullopt,
- OverloadCandidateParamOrder::Reversed);
+ AddOverloadCandidate(FD, F.getPair(),
+ {FunctionArgs[1], FunctionArgs[0]}, CandidateSet,
+ false, false, true, false, ADLCallKind::NotADL, {},
+ OverloadCandidateParamOrder::Reversed);
}
}
}
@@ -10102,8 +10102,7 @@ Sema::AddArgumentDependentLookupCandidates(DeclarationName Name,
FD, FoundDecl, {Args[1], Args[0]}, CandidateSet,
/*SuppressUserConversions=*/false, PartialOverloading,
/*AllowExplicit=*/true, /*AllowExplicitConversion=*/false,
- ADLCallKind::UsesADL, std::nullopt,
- OverloadCandidateParamOrder::Reversed);
+ ADLCallKind::UsesADL, {}, OverloadCandidateParamOrder::Reversed);
}
} else {
auto *FTD = cast<FunctionTemplateDecl>(*I);
@@ -15954,7 +15953,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
for (LookupResult::iterator Oper = R.begin(), OperEnd = R.end();
Oper != OperEnd; ++Oper) {
AddMethodCandidate(Oper.getPair(), Base->getType(), Base->Classify(Context),
- std::nullopt, CandidateSet,
+ {}, CandidateSet,
/*SuppressUserConversion=*/false);
}
@@ -16149,8 +16148,7 @@ Sema::BuildForRangeBeginEndCall(SourceLocation Loc,
*CallExpr = ExprError();
return FRS_DiagnosticIssued;
}
- *CallExpr =
- BuildCallExpr(S, MemberRef.get(), Loc, std::nullopt, Loc, nullptr);
+ *CallExpr = BuildCallExpr(S, MemberRef.get(), Loc, {}, Loc, nullptr);
if (CallExpr->isInvalid()) {
*CallExpr = ExprError();
return FRS_DiagnosticIssued;
diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp
index 30ed47e6e56ec9..c9379d25f7805c 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -746,11 +746,11 @@ ExprResult ObjCPropertyOpBuilder::buildGet() {
assert(InstanceReceiver || RefExpr->isSuperReceiver());
msg = S.ObjC().BuildInstanceMessageImplicit(
InstanceReceiver, receiverType, GenericLoc, Getter->getSelector(),
- Getter, std::nullopt);
+ Getter, {});
} else {
msg = S.ObjC().BuildClassMessageImplicit(
receiverType, RefExpr->isSuperReceiver(), GenericLoc,
- Getter->getSelector(), Getter, std::nullopt);
+ Getter->getSelector(), Getter, {});
}
return msg;
}
@@ -1131,7 +1131,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() {
/*TInfo=*/nullptr,
SC_None,
nullptr);
- AtIndexGetter->setMethodParams(S.Context, Argument, std::nullopt);
+ AtIndexGetter->setMethodParams(S.Context, Argument, {});
}
if (!AtIndexGetter) {
@@ -1243,7 +1243,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
SC_None,
nullptr);
Params.push_back(key);
- AtIndexSetter->setMethodParams(S.Context, Params, std::nullopt);
+ AtIndexSetter->setMethodParams(S.Context, Params, {});
}
if (!AtIndexSetter) {
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 9e235a46707cd4..38ae6d8116c3bb 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -390,7 +390,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) {
// type of the left operand could be used for SFINAE, so technically it is
// *used*.
if (DiagID != diag::warn_unused_comma_left_operand || !isSFINAEContext())
- DiagIfReachable(Loc, S ? llvm::ArrayRef(S) : std::nullopt,
+ DiagIfReachable(Loc, S ? llvm::ArrayRef(S) : llvm::ArrayRef<Stmt *>(),
PDiag(DiagID) << R1 << R2);
}
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 62f13610b5285c..fcf05798d9c709 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2991,7 +2991,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
// Fabricate an empty template parameter list for the invented header.
return TemplateParameterList::Create(Context, SourceLocation(),
- SourceLocation(), std::nullopt,
+ SourceLocation(), {},
SourceLocation(), nullptr);
}
diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
index 3a87128a7db0fa..698e0760d808fe 100644
--- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
+++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
@@ -1388,7 +1388,7 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
// additional function template derived as above from a hypothetical
// constructor C().
if (!AddedAny)
- Transform.buildSimpleDeductionGuide(std::nullopt);
+ Transform.buildSimpleDeductionGuide({});
// -- An additional function template derived as above from a hypothetical
// constructor C(C), called the copy deduction candidate.
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 198442dd9821ec..6a55861fe5af3b 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -732,8 +732,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate(
: InstantiatingTemplate(
SemaRef, CodeSynthesisContext::RequirementInstantiation,
PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr,
- /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt, &DeductionInfo) {
-}
+ /*Template=*/nullptr, /*TemplateArgs=*/{}, &DeductionInfo) {}
Sema::InstantiatingTemplate::InstantiatingTemplate(
Sema &SemaRef, SourceLocation PointOfInstantiation,
@@ -742,7 +741,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate(
: InstantiatingTemplate(
SemaRef, CodeSynthesisContext::NestedRequirementConstraintsCheck,
PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr,
- /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt) {}
+ /*Template=*/nullptr, /*TemplateArgs=*/{}) {}
Sema::InstantiatingTemplate::InstantiatingTemplate(
Sema &SemaRef, SourceLocation PointOfInstantiation, const RequiresExpr *RE,
@@ -750,8 +749,7 @@ Sema::InstantiatingTemplate::InstantiatingTemplate(
: InstantiatingTemplate(
SemaRef, CodeSynthesisContext::RequirementParameterInstantiation,
PointOfInstantiation, InstantiationRange, /*Entity=*/nullptr,
- /*Template=*/nullptr, /*TemplateArgs=*/std::nullopt, &DeductionInfo) {
-}
+ /*Template=*/nullptr, /*TemplateArgs=*/{}, &DeductionInfo) {}
Sema::InstantiatingTemplate::InstantiatingTemplate(
Sema &SemaRef, SourceLocation PointOfInstantiation,
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 6387fe9f1129ba..5d043e6684573c 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -803,7 +803,7 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state,
/*NumExceptions=*/0,
/*NoexceptExpr=*/nullptr,
/*ExceptionSpecTokens=*/nullptr,
- /*DeclsInPrototype=*/std::nullopt, loc, loc, declarator));
+ /*DeclsInPrototype=*/{}, loc, loc, declarator));
// For consistency, make sure the state still has us as processing
// the decl spec.
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index bd474cc637a48e..d24d8d5335e28d 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -3423,8 +3423,7 @@ class TreeTransform {
ExprResult RebuildCXXScalarValueInitExpr(TypeSourceInfo *TSInfo,
SourceLocation LParenLoc,
SourceLocation RParenLoc) {
- return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, std::nullopt,
- RParenLoc,
+ return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, {}, RParenLoc,
/*ListInitialization=*/false);
}
@@ -4243,13 +4242,13 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
// Revert value-initialization back to empty parens.
if (CXXScalarValueInitExpr *VIE = dyn_cast<CXXScalarValueInitExpr>(Init)) {
SourceRange Parens = VIE->getSourceRange();
- return getDerived().RebuildParenListExpr(Parens.getBegin(), std::nullopt,
+ return getDerived().RebuildParenListExpr(Parens.getBegin(), {},
Parens.getEnd());
}
// FIXME: We shouldn't build ImplicitValueInitExprs for direct-initialization.
if (isa<ImplicitValueInitExpr>(Init))
- return getDerived().RebuildParenListExpr(SourceLocation(), std::nullopt,
+ return getDerived().RebuildParenListExpr(SourceLocation(), {},
SourceLocation());
// Revert initialization by constructor back to a parenthesized or braced list
@@ -15444,7 +15443,7 @@ TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
return ExprError();
return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(), Pack, E->getPackLoc(), E->getRParenLoc(),
- std::nullopt, std::nullopt);
+ std::nullopt, {});
}
// Try to compute the result without performing a partial substitution.
@@ -15488,9 +15487,9 @@ TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
// Common case: we could determine the number of expansions without
// substituting.
if (Result)
- return getDerived().RebuildSizeOfPackExpr(
- E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
- *Result, std::nullopt);
+ return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
+ E->getPackLoc(),
+ E->getRParenLoc(), *Result, {});
TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(),
E->getPackLoc());
@@ -15521,7 +15520,7 @@ TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
E->getPackLoc(), E->getRParenLoc(),
- Args.size(), std::nullopt);
+ Args.size(), {});
}
template <typename Derived>
@@ -15565,7 +15564,7 @@ TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *E) {
return ExprError();
return getDerived().RebuildPackIndexingExpr(
E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
- std::nullopt);
+ {});
}
for (unsigned I = 0; I != *NumExpansions; ++I) {
Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index f21cbd11b6ab89..b5fe16bf6e787b 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -207,7 +207,7 @@ namespace clang {
return Common->PartialSpecializations;
}
ArrayRef<Decl> getPartialSpecializations(FunctionTemplateDecl::Common *) {
- return std::nullopt;
+ return {};
}
template<typename DeclTy>
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index 1efac6ac1c57f4..0ead95083e0e3d 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -554,7 +554,7 @@ std::optional<SVal> CallEvent::getReturnValueUnderConstruction() const {
ArrayRef<ParmVarDecl*> AnyFunctionCall::parameters() const {
const FunctionDecl *D = getDecl();
if (!D)
- return std::nullopt;
+ return {};
return D->parameters();
}
@@ -884,7 +884,7 @@ const BlockDataRegion *BlockCall::getBlockRegion() const {
ArrayRef<ParmVarDecl*> BlockCall::parameters() const {
const BlockDecl *D = getDecl();
if (!D)
- return std::nullopt;
+ return {};
return D->parameters();
}
@@ -981,7 +981,7 @@ RuntimeDefinition CXXDestructorCall::getRuntimeDefinition() const {
ArrayRef<ParmVarDecl*> ObjCMethodCall::parameters() const {
const ObjCMethodDecl *D = getDecl();
if (!D)
- return std::nullopt;
+ return {};
return D->parameters();
}
diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
index 693791c3aee8b9..0a29a050bbc2ba 100644
--- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -1079,7 +1079,7 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D,
T = getContext().VoidTy;
if (!T->getAs<FunctionType>()) {
FunctionProtoType::ExtProtoInfo Ext;
- T = getContext().getFunctionType(T, std::nullopt, Ext);
+ T = getContext().getFunctionType(T, {}, Ext);
}
T = getContext().getBlockPointerType(T);
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 55dd3d7b691143..5475f7143db992 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4238,8 +4238,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
LibclangInvocationReporter InvocationReporter(
*CXXIdx, LibclangInvocationReporter::OperationKind::ParseOperation,
- options, llvm::ArrayRef(*Args), /*InvocationArgs=*/std::nullopt,
- unsaved_files);
+ options, llvm::ArrayRef(*Args), /*InvocationArgs=*/{}, unsaved_files);
std::unique_ptr<ASTUnit> Unit = ASTUnit::LoadFromCommandLine(
Args->data(), Args->data() + Args->size(),
CXXIdx->getPCHContainerOperations(), Diags,
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
index 0209703395bc11..22fe347c425593 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
@@ -1371,9 +1371,9 @@ class UncheckedOptionalAccessTest
new DiagnosticOptions());
TextDiagnostic TD(llvm::errs(), AO.ASTCtx.getLangOpts(),
DiagOpts.get());
- TD.emitDiagnostic(
- FullSourceLoc(Loc, SrcMgr), DiagnosticsEngine::Error,
- "unexpected diagnostic", std::nullopt, std::nullopt);
+ TD.emitDiagnostic(FullSourceLoc(Loc, SrcMgr),
+ DiagnosticsEngine::Error,
+ "unexpected diagnostic", {}, {});
}
}
diff --git a/clang/unittests/Frontend/ASTUnitTest.cpp b/clang/unittests/Frontend/ASTUnitTest.cpp
index 19b5d9bb41466a..bd5d5d00981807 100644
--- a/clang/unittests/Frontend/ASTUnitTest.cpp
+++ b/clang/unittests/Frontend/ASTUnitTest.cpp
@@ -168,9 +168,9 @@ TEST_F(ASTUnitTest, LoadFromCommandLineEarlyError) {
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCommandLine(
&Args[0], &Args[4], PCHContainerOps, Diags, "", false, "", false,
- CaptureDiagsKind::All, std::nullopt, true, 0, TU_Complete, false, false,
- false, SkipFunctionBodiesScope::None, false, true, false, false,
- std::nullopt, &ErrUnit, nullptr);
+ CaptureDiagsKind::All, {}, true, 0, TU_Complete, false, false, false,
+ SkipFunctionBodiesScope::None, false, true, false, false, std::nullopt,
+ &ErrUnit, nullptr);
ASSERT_EQ(AST, nullptr);
ASSERT_NE(ErrUnit, nullptr);
@@ -195,9 +195,9 @@ TEST_F(ASTUnitTest, LoadFromCommandLineWorkingDirectory) {
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCommandLine(
&Args[0], &Args[4], PCHContainerOps, Diags, "", false, "", false,
- CaptureDiagsKind::All, std::nullopt, true, 0, TU_Complete, false, false,
- false, SkipFunctionBodiesScope::None, false, true, false, false,
- std::nullopt, &ErrUnit, nullptr);
+ CaptureDiagsKind::All, {}, true, 0, TU_Complete, false, false, false,
+ SkipFunctionBodiesScope::None, false, true, false, false, std::nullopt,
+ &ErrUnit, nullptr);
ASSERT_NE(AST, nullptr);
ASSERT_FALSE(Diags->hasErrorOccurred());
diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp
index 59c023ca336063..35c8fcf69910b6 100644
--- a/clang/utils/TableGen/NeonEmitter.cpp
+++ b/clang/utils/TableGen/NeonEmitter.cpp
@@ -1685,7 +1685,7 @@ Intrinsic::DagEmitter::emitDagShuffle(const DagInit *DI) {
std::make_unique<Rev>(Arg1.first.getElementSizeInBits()));
ST.addExpander("MaskExpand",
std::make_unique<MaskExpander>(Arg1.first.getNumElements()));
- ST.evaluate(DI->getArg(2), Elts, std::nullopt);
+ ST.evaluate(DI->getArg(2), Elts, {});
std::string S = "__builtin_shufflevector(" + Arg1.second + ", " + Arg2.second;
for (auto &E : Elts) {
More information about the cfe-commits
mailing list