[AST] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
parent
8595f2e54d
commit
e31564afc3
|
@ -2293,7 +2293,7 @@ public:
|
||||||
|
|
||||||
Optional<CharUnits> getTypeSizeInCharsIfKnown(QualType Ty) const {
|
Optional<CharUnits> getTypeSizeInCharsIfKnown(QualType Ty) const {
|
||||||
if (Ty->isIncompleteType() || Ty->isDependentType())
|
if (Ty->isIncompleteType() || Ty->isDependentType())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return getTypeSizeInChars(Ty);
|
return getTypeSizeInChars(Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
if (Pos != ImportErrors.end())
|
if (Pos != ImportErrors.end())
|
||||||
return Pos->second;
|
return Pos->second;
|
||||||
else
|
else
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setImportDeclError(Decl *To, ASTImportError Error) {
|
void setImportDeclError(Decl *To, ASTImportError Error) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
ArrayRef<T> copyArray(ArrayRef<T> Source) {
|
ArrayRef<T> copyArray(ArrayRef<T> Source) {
|
||||||
if (!Source.empty())
|
if (!Source.empty())
|
||||||
return Source.copy(Allocator);
|
return Source.copy(Allocator);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphComment *actOnParagraphComment(
|
ParagraphComment *actOnParagraphComment(
|
||||||
|
|
|
@ -108,11 +108,10 @@ public:
|
||||||
friend class ASTNodeImporter;
|
friend class ASTNodeImporter;
|
||||||
friend TrailingObjects;
|
friend TrailingObjects;
|
||||||
|
|
||||||
static FriendDecl *Create(ASTContext &C, DeclContext *DC,
|
static FriendDecl *
|
||||||
SourceLocation L, FriendUnion Friend_,
|
Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_,
|
||||||
SourceLocation FriendL,
|
SourceLocation FriendL,
|
||||||
ArrayRef<TemplateParameterList*> FriendTypeTPLists
|
ArrayRef<TemplateParameterList *> FriendTypeTPLists = std::nullopt);
|
||||||
= None);
|
|
||||||
static FriendDecl *CreateDeserialized(ASTContext &C, unsigned ID,
|
static FriendDecl *CreateDeserialized(ASTContext &C, unsigned ID,
|
||||||
unsigned FriendTypeNumTPLists);
|
unsigned FriendTypeNumTPLists);
|
||||||
|
|
||||||
|
|
|
@ -389,9 +389,8 @@ public:
|
||||||
/// Sets the method's parameters and selector source locations.
|
/// Sets the method's parameters and selector source locations.
|
||||||
/// If the method is implicit (not coming from source) \p SelLocs is
|
/// If the method is implicit (not coming from source) \p SelLocs is
|
||||||
/// ignored.
|
/// ignored.
|
||||||
void setMethodParams(ASTContext &C,
|
void setMethodParams(ASTContext &C, ArrayRef<ParmVarDecl *> Params,
|
||||||
ArrayRef<ParmVarDecl*> Params,
|
ArrayRef<SourceLocation> SelLocs = std::nullopt);
|
||||||
ArrayRef<SourceLocation> SelLocs = llvm::None);
|
|
||||||
|
|
||||||
// Iterator access to parameter types.
|
// Iterator access to parameter types.
|
||||||
struct GetTypeFn {
|
struct GetTypeFn {
|
||||||
|
|
|
@ -34,7 +34,7 @@ template <typename U> class OMPDeclarativeDirective : public U {
|
||||||
/// Get the clauses storage.
|
/// Get the clauses storage.
|
||||||
MutableArrayRef<OMPClause *> getClauses() {
|
MutableArrayRef<OMPClause *> getClauses() {
|
||||||
if (!Data)
|
if (!Data)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
return Data->getClauses();
|
return Data->getClauses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
ArrayRef<OMPClause *> clauses() const {
|
ArrayRef<OMPClause *> clauses() const {
|
||||||
if (!Data)
|
if (!Data)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
return Data->getClauses();
|
return Data->getClauses();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1245,14 +1245,11 @@ class TemplateTypeParmDecl final : public TypeDecl,
|
||||||
NumExpanded(NumExpanded.value_or(0)) {}
|
NumExpanded(NumExpanded.value_or(0)) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TemplateTypeParmDecl *Create(const ASTContext &C, DeclContext *DC,
|
static TemplateTypeParmDecl *
|
||||||
SourceLocation KeyLoc,
|
Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc,
|
||||||
SourceLocation NameLoc,
|
SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id,
|
||||||
unsigned D, unsigned P,
|
bool Typename, bool ParameterPack, bool HasTypeConstraint = false,
|
||||||
IdentifierInfo *Id, bool Typename,
|
Optional<unsigned> NumExpanded = std::nullopt);
|
||||||
bool ParameterPack,
|
|
||||||
bool HasTypeConstraint = false,
|
|
||||||
Optional<unsigned> NumExpanded = None);
|
|
||||||
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
||||||
unsigned ID);
|
unsigned ID);
|
||||||
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
||||||
|
@ -3453,7 +3450,7 @@ inline Optional<unsigned> getExpandedPackSize(const NamedDecl *Param) {
|
||||||
return TTP->getNumExpansionTemplateParameters();
|
return TTP->getNumExpansionTemplateParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Internal helper used by Subst* nodes to retrieve the parameter list
|
/// Internal helper used by Subst* nodes to retrieve the parameter list
|
||||||
|
|
|
@ -2273,13 +2273,13 @@ public:
|
||||||
/// If the result is not-None, it will never wrap a nullptr.
|
/// If the result is not-None, it will never wrap a nullptr.
|
||||||
Optional<Expr *> getArraySize() {
|
Optional<Expr *> getArraySize() {
|
||||||
if (!isArray())
|
if (!isArray())
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
if (auto *Result =
|
if (auto *Result =
|
||||||
cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
|
cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This might return None even if isArray() returns true,
|
/// This might return None even if isArray() returns true,
|
||||||
|
@ -2287,13 +2287,13 @@ public:
|
||||||
/// If the result is not-None, it will never wrap a nullptr.
|
/// If the result is not-None, it will never wrap a nullptr.
|
||||||
Optional<const Expr *> getArraySize() const {
|
Optional<const Expr *> getArraySize() const {
|
||||||
if (!isArray())
|
if (!isArray())
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
if (auto *Result =
|
if (auto *Result =
|
||||||
cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
|
cast_or_null<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getNumPlacementArgs() const {
|
unsigned getNumPlacementArgs() const {
|
||||||
|
@ -4116,7 +4116,7 @@ public:
|
||||||
if (NumExpansions)
|
if (NumExpansions)
|
||||||
return NumExpansions - 1;
|
return NumExpansions - 1;
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation getBeginLoc() const LLVM_READONLY {
|
SourceLocation getBeginLoc() const LLVM_READONLY {
|
||||||
|
@ -4201,11 +4201,11 @@ class SizeOfPackExpr final
|
||||||
: Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
|
: Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc,
|
static SizeOfPackExpr *
|
||||||
NamedDecl *Pack, SourceLocation PackLoc,
|
Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack,
|
||||||
SourceLocation RParenLoc,
|
SourceLocation PackLoc, SourceLocation RParenLoc,
|
||||||
Optional<unsigned> Length = None,
|
Optional<unsigned> Length = std::nullopt,
|
||||||
ArrayRef<TemplateArgument> PartialArgs = None);
|
ArrayRef<TemplateArgument> PartialArgs = std::nullopt);
|
||||||
static SizeOfPackExpr *CreateDeserialized(ASTContext &Context,
|
static SizeOfPackExpr *CreateDeserialized(ASTContext &Context,
|
||||||
unsigned NumPartialArgs);
|
unsigned NumPartialArgs);
|
||||||
|
|
||||||
|
@ -4316,7 +4316,7 @@ public:
|
||||||
|
|
||||||
Optional<unsigned> getPackIndex() const {
|
Optional<unsigned> getPackIndex() const {
|
||||||
if (PackIndex == 0)
|
if (PackIndex == 0)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return PackIndex - 1;
|
return PackIndex - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4681,7 +4681,7 @@ public:
|
||||||
Optional<unsigned> getNumExpansions() const {
|
Optional<unsigned> getNumExpansions() const {
|
||||||
if (NumExpansions)
|
if (NumExpansions)
|
||||||
return NumExpansions - 1;
|
return NumExpansions - 1;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation getBeginLoc() const LLVM_READONLY {
|
SourceLocation getBeginLoc() const LLVM_READONLY {
|
||||||
|
|
|
@ -362,7 +362,8 @@ public:
|
||||||
ObjCDictionaryElement getKeyValueElement(unsigned Index) const {
|
ObjCDictionaryElement getKeyValueElement(unsigned Index) const {
|
||||||
assert((Index < NumElements) && "Arg access out of range!");
|
assert((Index < NumElements) && "Arg access out of range!");
|
||||||
const KeyValuePair &KV = getTrailingObjects<KeyValuePair>()[Index];
|
const KeyValuePair &KV = getTrailingObjects<KeyValuePair>()[Index];
|
||||||
ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None };
|
ObjCDictionaryElement Result = {KV.Key, KV.Value, SourceLocation(),
|
||||||
|
std::nullopt};
|
||||||
if (HasPackExpansions) {
|
if (HasPackExpansions) {
|
||||||
const ExpansionData &Expansion =
|
const ExpansionData &Expansion =
|
||||||
getTrailingObjects<ExpansionData>()[Index];
|
getTrailingObjects<ExpansionData>()[Index];
|
||||||
|
|
|
@ -5838,14 +5838,14 @@ public:
|
||||||
return const_component_lists_iterator(
|
return const_component_lists_iterator(
|
||||||
getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(),
|
getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(),
|
||||||
getComponentsRef(), SupportsMapper,
|
getComponentsRef(), SupportsMapper,
|
||||||
SupportsMapper ? getUDMapperRefs() : llvm::None);
|
SupportsMapper ? getUDMapperRefs() : std::nullopt);
|
||||||
}
|
}
|
||||||
const_component_lists_iterator component_lists_end() const {
|
const_component_lists_iterator component_lists_end() const {
|
||||||
return const_component_lists_iterator(
|
return const_component_lists_iterator(
|
||||||
ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(),
|
ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(),
|
||||||
MappableExprComponentListRef(getComponentsRef().end(),
|
MappableExprComponentListRef(getComponentsRef().end(),
|
||||||
getComponentsRef().end()),
|
getComponentsRef().end()),
|
||||||
SupportsMapper, llvm::None);
|
SupportsMapper, std::nullopt);
|
||||||
}
|
}
|
||||||
const_component_lists_range component_lists() const {
|
const_component_lists_range component_lists() const {
|
||||||
return {component_lists_begin(), component_lists_end()};
|
return {component_lists_begin(), component_lists_end()};
|
||||||
|
@ -5858,7 +5858,7 @@ public:
|
||||||
return const_component_lists_iterator(
|
return const_component_lists_iterator(
|
||||||
VD, getUniqueDeclsRef(), getDeclNumListsRef(),
|
VD, getUniqueDeclsRef(), getDeclNumListsRef(),
|
||||||
getComponentListSizesRef(), getComponentsRef(), SupportsMapper,
|
getComponentListSizesRef(), getComponentsRef(), SupportsMapper,
|
||||||
SupportsMapper ? getUDMapperRefs() : llvm::None);
|
SupportsMapper ? getUDMapperRefs() : std::nullopt);
|
||||||
}
|
}
|
||||||
const_component_lists_iterator decl_component_lists_end() const {
|
const_component_lists_iterator decl_component_lists_end() const {
|
||||||
return component_lists_end();
|
return component_lists_end();
|
||||||
|
|
|
@ -277,7 +277,7 @@ class OMPExecutableDirective : public Stmt {
|
||||||
/// Get the clauses storage.
|
/// Get the clauses storage.
|
||||||
MutableArrayRef<OMPClause *> getClauses() {
|
MutableArrayRef<OMPClause *> getClauses() {
|
||||||
if (!Data)
|
if (!Data)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
return Data->getClauses();
|
return Data->getClauses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ public:
|
||||||
|
|
||||||
ArrayRef<OMPClause *> clauses() const {
|
ArrayRef<OMPClause *> clauses() const {
|
||||||
if (!Data)
|
if (!Data)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
return Data->getClauses();
|
return Data->getClauses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,9 @@ public:
|
||||||
|
|
||||||
TemplateArgument(TemplateName, bool) = delete;
|
TemplateArgument(TemplateName, bool) = delete;
|
||||||
|
|
||||||
static TemplateArgument getEmptyPack() { return TemplateArgument(None); }
|
static TemplateArgument getEmptyPack() {
|
||||||
|
return TemplateArgument(std::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a new template argument pack by copying the given set of
|
/// Create a new template argument pack by copying the given set of
|
||||||
/// template arguments.
|
/// template arguments.
|
||||||
|
|
|
@ -397,7 +397,7 @@ public:
|
||||||
|
|
||||||
Optional<unsigned> getPackIndex() const {
|
Optional<unsigned> getPackIndex() const {
|
||||||
if (Bits.Data == 0)
|
if (Bits.Data == 0)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Bits.Data - 1;
|
return Bits.Data - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5113,7 +5113,7 @@ public:
|
||||||
|
|
||||||
Optional<unsigned> getPackIndex() const {
|
Optional<unsigned> getPackIndex() const {
|
||||||
if (SubstTemplateTypeParmTypeBits.PackIndex == 0)
|
if (SubstTemplateTypeParmTypeBits.PackIndex == 0)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return SubstTemplateTypeParmTypeBits.PackIndex - 1;
|
return SubstTemplateTypeParmTypeBits.PackIndex - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5855,7 +5855,7 @@ public:
|
||||||
Optional<unsigned> getNumExpansions() const {
|
Optional<unsigned> getNumExpansions() const {
|
||||||
if (PackExpansionTypeBits.NumExpansions)
|
if (PackExpansionTypeBits.NumExpansions)
|
||||||
return PackExpansionTypeBits.NumExpansions - 1;
|
return PackExpansionTypeBits.NumExpansions - 1;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSugared() const { return false; }
|
bool isSugared() const { return false; }
|
||||||
|
|
|
@ -771,9 +771,9 @@ canonicalizeImmediatelyDeclaredConstraint(const ASTContext &C, Expr *IDC,
|
||||||
|
|
||||||
if (auto *OrigFold = dyn_cast<CXXFoldExpr>(IDC))
|
if (auto *OrigFold = dyn_cast<CXXFoldExpr>(IDC))
|
||||||
NewIDC = new (C) CXXFoldExpr(
|
NewIDC = new (C) CXXFoldExpr(
|
||||||
OrigFold->getType(), /*Callee*/nullptr, SourceLocation(), NewIDC,
|
OrigFold->getType(), /*Callee*/ nullptr, SourceLocation(), NewIDC,
|
||||||
BinaryOperatorKind::BO_LAnd, SourceLocation(), /*RHS=*/nullptr,
|
BinaryOperatorKind::BO_LAnd, SourceLocation(), /*RHS=*/nullptr,
|
||||||
SourceLocation(), /*NumExpansions=*/None);
|
SourceLocation(), /*NumExpansions=*/std::nullopt);
|
||||||
return NewIDC;
|
return NewIDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,12 +797,13 @@ ASTContext::getCanonicalTemplateTemplateParmDecl(
|
||||||
PEnd = Params->end();
|
PEnd = Params->end();
|
||||||
P != PEnd; ++P) {
|
P != PEnd; ++P) {
|
||||||
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*P)) {
|
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*P)) {
|
||||||
TemplateTypeParmDecl *NewTTP = TemplateTypeParmDecl::Create(*this,
|
TemplateTypeParmDecl *NewTTP = TemplateTypeParmDecl::Create(
|
||||||
getTranslationUnitDecl(), SourceLocation(), SourceLocation(),
|
*this, getTranslationUnitDecl(), SourceLocation(), SourceLocation(),
|
||||||
TTP->getDepth(), TTP->getIndex(), nullptr, false,
|
TTP->getDepth(), TTP->getIndex(), nullptr, false,
|
||||||
TTP->isParameterPack(), TTP->hasTypeConstraint(),
|
TTP->isParameterPack(), TTP->hasTypeConstraint(),
|
||||||
TTP->isExpandedParameterPack() ?
|
TTP->isExpandedParameterPack()
|
||||||
llvm::Optional<unsigned>(TTP->getNumExpansionParameters()) : None);
|
? llvm::Optional<unsigned>(TTP->getNumExpansionParameters())
|
||||||
|
: std::nullopt);
|
||||||
if (const auto *TC = TTP->getTypeConstraint()) {
|
if (const auto *TC = TTP->getTypeConstraint()) {
|
||||||
QualType ParamAsArgument(NewTTP->getTypeForDecl(), 0);
|
QualType ParamAsArgument(NewTTP->getTypeForDecl(), 0);
|
||||||
Expr *NewIDC = canonicalizeImmediatelyDeclaredConstraint(
|
Expr *NewIDC = canonicalizeImmediatelyDeclaredConstraint(
|
||||||
|
@ -1139,7 +1140,7 @@ ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) {
|
||||||
auto MergedIt =
|
auto MergedIt =
|
||||||
MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl()));
|
MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl()));
|
||||||
if (MergedIt == MergedDefModules.end())
|
if (MergedIt == MergedDefModules.end())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return MergedIt->second;
|
return MergedIt->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1198,7 @@ void ASTContext::addLazyModuleInitializers(Module *M, ArrayRef<uint32_t> IDs) {
|
||||||
ArrayRef<Decl *> ASTContext::getModuleInitializers(Module *M) {
|
ArrayRef<Decl *> ASTContext::getModuleInitializers(Module *M) {
|
||||||
auto It = ModuleInitializers.find(M);
|
auto It = ModuleInitializers.find(M);
|
||||||
if (It == ModuleInitializers.end())
|
if (It == ModuleInitializers.end())
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
auto *Inits = It->second;
|
auto *Inits = It->second;
|
||||||
Inits->resolve(*this);
|
Inits->resolve(*this);
|
||||||
|
@ -2743,7 +2744,7 @@ getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context) {
|
||||||
bool IsBitIntType = Field->getType()->isBitIntType();
|
bool IsBitIntType = Field->getType()->isBitIntType();
|
||||||
if (!Field->getType()->isReferenceType() && !IsBitIntType &&
|
if (!Field->getType()->isReferenceType() && !IsBitIntType &&
|
||||||
!Context.hasUniqueObjectRepresentations(Field->getType()))
|
!Context.hasUniqueObjectRepresentations(Field->getType()))
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
|
|
||||||
int64_t FieldSizeInBits =
|
int64_t FieldSizeInBits =
|
||||||
Context.toBits(Context.getTypeSizeInChars(Field->getType()));
|
Context.toBits(Context.getTypeSizeInChars(Field->getType()));
|
||||||
|
@ -2752,14 +2753,14 @@ getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context) {
|
||||||
if (IsBitIntType) {
|
if (IsBitIntType) {
|
||||||
if ((unsigned)BitfieldSize >
|
if ((unsigned)BitfieldSize >
|
||||||
cast<BitIntType>(Field->getType())->getNumBits())
|
cast<BitIntType>(Field->getType())->getNumBits())
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
} else if (BitfieldSize > FieldSizeInBits) {
|
} else if (BitfieldSize > FieldSizeInBits) {
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
FieldSizeInBits = BitfieldSize;
|
FieldSizeInBits = BitfieldSize;
|
||||||
} else if (IsBitIntType &&
|
} else if (IsBitIntType &&
|
||||||
!Context.hasUniqueObjectRepresentations(Field->getType())) {
|
!Context.hasUniqueObjectRepresentations(Field->getType())) {
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return FieldSizeInBits;
|
return FieldSizeInBits;
|
||||||
}
|
}
|
||||||
|
@ -2777,11 +2778,11 @@ static llvm::Optional<int64_t> structSubobjectsHaveUniqueObjectRepresentations(
|
||||||
llvm::Optional<int64_t> SizeInBits =
|
llvm::Optional<int64_t> SizeInBits =
|
||||||
getSubobjectSizeInBits(Subobject, Context);
|
getSubobjectSizeInBits(Subobject, Context);
|
||||||
if (!SizeInBits)
|
if (!SizeInBits)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
if (*SizeInBits != 0) {
|
if (*SizeInBits != 0) {
|
||||||
int64_t Offset = getSubobjectOffset(Subobject, Context, Layout);
|
int64_t Offset = getSubobjectOffset(Subobject, Context, Layout);
|
||||||
if (Offset != CurOffsetInBits)
|
if (Offset != CurOffsetInBits)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
CurOffsetInBits += *SizeInBits;
|
CurOffsetInBits += *SizeInBits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2797,7 +2798,7 @@ structHasUniqueObjectRepresentations(const ASTContext &Context,
|
||||||
int64_t CurOffsetInBits = 0;
|
int64_t CurOffsetInBits = 0;
|
||||||
if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
|
if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
|
||||||
if (ClassDecl->isDynamicClass())
|
if (ClassDecl->isDynamicClass())
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
|
|
||||||
SmallVector<CXXRecordDecl *, 4> Bases;
|
SmallVector<CXXRecordDecl *, 4> Bases;
|
||||||
for (const auto &Base : ClassDecl->bases()) {
|
for (const auto &Base : ClassDecl->bases()) {
|
||||||
|
@ -2814,7 +2815,7 @@ structHasUniqueObjectRepresentations(const ASTContext &Context,
|
||||||
structSubobjectsHaveUniqueObjectRepresentations(Bases, CurOffsetInBits,
|
structSubobjectsHaveUniqueObjectRepresentations(Bases, CurOffsetInBits,
|
||||||
Context, Layout);
|
Context, Layout);
|
||||||
if (!OffsetAfterBases)
|
if (!OffsetAfterBases)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
CurOffsetInBits = *OffsetAfterBases;
|
CurOffsetInBits = *OffsetAfterBases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2822,7 +2823,7 @@ structHasUniqueObjectRepresentations(const ASTContext &Context,
|
||||||
structSubobjectsHaveUniqueObjectRepresentations(
|
structSubobjectsHaveUniqueObjectRepresentations(
|
||||||
RD->fields(), CurOffsetInBits, Context, Layout);
|
RD->fields(), CurOffsetInBits, Context, Layout);
|
||||||
if (!OffsetAfterFields)
|
if (!OffsetAfterFields)
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
CurOffsetInBits = *OffsetAfterFields;
|
CurOffsetInBits = *OffsetAfterFields;
|
||||||
|
|
||||||
return CurOffsetInBits;
|
return CurOffsetInBits;
|
||||||
|
@ -5218,7 +5219,7 @@ TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) {
|
||||||
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
|
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
|
||||||
QualType ArgType = getTypeDeclType(TTP);
|
QualType ArgType = getTypeDeclType(TTP);
|
||||||
if (TTP->isParameterPack())
|
if (TTP->isParameterPack())
|
||||||
ArgType = getPackExpansionType(ArgType, None);
|
ArgType = getPackExpansionType(ArgType, std::nullopt);
|
||||||
|
|
||||||
Arg = TemplateArgument(ArgType);
|
Arg = TemplateArgument(ArgType);
|
||||||
} else if (auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
|
} else if (auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
|
||||||
|
@ -5235,8 +5236,8 @@ TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) {
|
||||||
Expr::getValueKindForType(NTTP->getType()), NTTP->getLocation());
|
Expr::getValueKindForType(NTTP->getType()), NTTP->getLocation());
|
||||||
|
|
||||||
if (NTTP->isParameterPack())
|
if (NTTP->isParameterPack())
|
||||||
E = new (*this) PackExpansionExpr(DependentTy, E, NTTP->getLocation(),
|
E = new (*this)
|
||||||
None);
|
PackExpansionExpr(DependentTy, E, NTTP->getLocation(), std::nullopt);
|
||||||
Arg = TemplateArgument(E);
|
Arg = TemplateArgument(E);
|
||||||
} else {
|
} else {
|
||||||
auto *TTP = cast<TemplateTemplateParmDecl>(Param);
|
auto *TTP = cast<TemplateTemplateParmDecl>(Param);
|
||||||
|
@ -11923,7 +11924,7 @@ MangleContext *ASTContext::createDeviceMangleContext(const TargetInfo &T) {
|
||||||
[](ASTContext &, const NamedDecl *ND) -> llvm::Optional<unsigned> {
|
[](ASTContext &, const NamedDecl *ND) -> llvm::Optional<unsigned> {
|
||||||
if (const auto *RD = dyn_cast<CXXRecordDecl>(ND))
|
if (const auto *RD = dyn_cast<CXXRecordDecl>(ND))
|
||||||
return RD->getDeviceLambdaManglingNumber();
|
return RD->getDeviceLambdaManglingNumber();
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
},
|
},
|
||||||
/*IsAux=*/true);
|
/*IsAux=*/true);
|
||||||
case TargetCXXABI::Microsoft:
|
case TargetCXXABI::Microsoft:
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace clang {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Expected<Optional<T>> import(Optional<T> From) {
|
Expected<Optional<T>> import(Optional<T> From) {
|
||||||
if (!From)
|
if (!From)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return import(*From);
|
return import(*From);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8544,7 +8544,7 @@ Optional<unsigned> ASTImporter::getFieldIndex(Decl *F) {
|
||||||
|
|
||||||
auto *Owner = dyn_cast<RecordDecl>(F->getDeclContext());
|
auto *Owner = dyn_cast<RecordDecl>(F->getDeclContext());
|
||||||
if (!Owner)
|
if (!Owner)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
unsigned Index = 0;
|
unsigned Index = 0;
|
||||||
for (const auto *D : Owner->decls()) {
|
for (const auto *D : Owner->decls()) {
|
||||||
|
@ -8557,7 +8557,7 @@ Optional<unsigned> ASTImporter::getFieldIndex(Decl *F) {
|
||||||
|
|
||||||
llvm_unreachable("Field was not found in its parent context.");
|
llvm_unreachable("Field was not found in its parent context.");
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTImporter::FoundDeclsTy
|
ASTImporter::FoundDeclsTy
|
||||||
|
@ -10022,7 +10022,7 @@ ASTImporter::getImportDeclErrorIfAny(Decl *FromD) const {
|
||||||
if (Pos != ImportDeclErrors.end())
|
if (Pos != ImportDeclErrors.end())
|
||||||
return Pos->second;
|
return Pos->second;
|
||||||
else
|
else
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTImporter::setImportDeclError(Decl *From, ASTImportError Error) {
|
void ASTImporter::setImportDeclError(Decl *From, ASTImportError Error) {
|
||||||
|
|
|
@ -2128,7 +2128,7 @@ StructuralEquivalenceContext::findUntaggedStructOrUnionIndex(RecordDecl *Anon) {
|
||||||
|
|
||||||
const auto *Owner = dyn_cast<RecordDecl>(Anon->getDeclContext());
|
const auto *Owner = dyn_cast<RecordDecl>(Anon->getDeclContext());
|
||||||
if (!Owner)
|
if (!Owner)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
unsigned Index = 0;
|
unsigned Index = 0;
|
||||||
for (const auto *D : Owner->noload_decls()) {
|
for (const auto *D : Owner->noload_decls()) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ void OMPDeclareTargetDeclAttr::printPrettyPragma(
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *>
|
llvm::Optional<OMPDeclareTargetDeclAttr *>
|
||||||
OMPDeclareTargetDeclAttr::getActiveAttr(const ValueDecl *VD) {
|
OMPDeclareTargetDeclAttr::getActiveAttr(const ValueDecl *VD) {
|
||||||
if (!VD->hasAttrs())
|
if (!VD->hasAttrs())
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
unsigned Level = 0;
|
unsigned Level = 0;
|
||||||
OMPDeclareTargetDeclAttr *FoundAttr = nullptr;
|
OMPDeclareTargetDeclAttr *FoundAttr = nullptr;
|
||||||
for (auto *Attr : VD->specific_attrs<OMPDeclareTargetDeclAttr>()) {
|
for (auto *Attr : VD->specific_attrs<OMPDeclareTargetDeclAttr>()) {
|
||||||
|
@ -162,7 +162,7 @@ OMPDeclareTargetDeclAttr::getActiveAttr(const ValueDecl *VD) {
|
||||||
}
|
}
|
||||||
if (FoundAttr)
|
if (FoundAttr)
|
||||||
return FoundAttr;
|
return FoundAttr;
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy>
|
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy>
|
||||||
|
@ -170,7 +170,7 @@ OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr)
|
||||||
return ActiveAttr.value()->getMapType();
|
return ActiveAttr.value()->getMapType();
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr::DevTypeTy>
|
llvm::Optional<OMPDeclareTargetDeclAttr::DevTypeTy>
|
||||||
|
@ -178,7 +178,7 @@ OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr)
|
||||||
return ActiveAttr.value()->getDevType();
|
return ActiveAttr.value()->getDevType();
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Optional<SourceLocation>
|
llvm::Optional<SourceLocation>
|
||||||
|
@ -186,7 +186,7 @@ OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr)
|
||||||
return ActiveAttr.value()->getRange().getBegin();
|
return ActiveAttr.value()->getRange().getBegin();
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
|
@ -206,7 +206,7 @@ void DeclInfo::fill() {
|
||||||
IsInstanceMethod = false;
|
IsInstanceMethod = false;
|
||||||
IsClassMethod = false;
|
IsClassMethod = false;
|
||||||
IsVariadic = false;
|
IsVariadic = false;
|
||||||
ParamVars = None;
|
ParamVars = std::nullopt;
|
||||||
TemplateParameters = nullptr;
|
TemplateParameters = nullptr;
|
||||||
|
|
||||||
if (!CommentDecl) {
|
if (!CommentDecl) {
|
||||||
|
|
|
@ -334,7 +334,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
|
||||||
if (isTokBlockCommand()) {
|
if (isTokBlockCommand()) {
|
||||||
// Block command ahead. We can't nest block commands, so pretend that this
|
// Block command ahead. We can't nest block commands, so pretend that this
|
||||||
// command has an empty argument.
|
// command has an empty argument.
|
||||||
ParagraphComment *Paragraph = S.actOnParagraphComment(None);
|
ParagraphComment *Paragraph = S.actOnParagraphComment(std::nullopt);
|
||||||
if (PC) {
|
if (PC) {
|
||||||
S.actOnParamCommandFinish(PC, Paragraph);
|
S.actOnParamCommandFinish(PC, Paragraph);
|
||||||
return PC;
|
return PC;
|
||||||
|
@ -376,7 +376,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
|
||||||
|
|
||||||
ParagraphComment *Paragraph;
|
ParagraphComment *Paragraph;
|
||||||
if (EmptyParagraph)
|
if (EmptyParagraph)
|
||||||
Paragraph = S.actOnParagraphComment(None);
|
Paragraph = S.actOnParagraphComment(std::nullopt);
|
||||||
else {
|
else {
|
||||||
BlockContentComment *Block = parseParagraphOrBlockCommand();
|
BlockContentComment *Block = parseParagraphOrBlockCommand();
|
||||||
// Since we have checked for a block command, we should have parsed a
|
// Since we have checked for a block command, we should have parsed a
|
||||||
|
|
|
@ -37,7 +37,7 @@ clang::getComparisonCategoryForBuiltinCmp(QualType T) {
|
||||||
return CCT::StrongOrdering;
|
return CCT::StrongOrdering;
|
||||||
|
|
||||||
// TODO: Extend support for operator<=> to ObjC types.
|
// TODO: Extend support for operator<=> to ObjC types.
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ComparisonCategoryInfo::ValueInfo::hasValidIntValue() const {
|
bool ComparisonCategoryInfo::ValueInfo::hasValidIntValue() const {
|
||||||
|
|
|
@ -235,7 +235,7 @@ static Optional<Visibility> getVisibilityOf(const NamedDecl *D,
|
||||||
return getVisibilityFromAttr(A);
|
return getVisibilityFromAttr(A);
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkageInfo LinkageComputer::getLVForType(const Type &T,
|
LinkageInfo LinkageComputer::getLVForType(const Type &T,
|
||||||
|
@ -1194,11 +1194,11 @@ getExplicitVisibilityAux(const NamedDecl *ND,
|
||||||
const auto *TD = spec->getSpecializedTemplate()->getTemplatedDecl();
|
const auto *TD = spec->getSpecializedTemplate()->getTemplatedDecl();
|
||||||
while (TD != nullptr) {
|
while (TD != nullptr) {
|
||||||
auto Vis = getVisibilityOf(TD, kind);
|
auto Vis = getVisibilityOf(TD, kind);
|
||||||
if (Vis != None)
|
if (Vis != std::nullopt)
|
||||||
return Vis;
|
return Vis;
|
||||||
TD = TD->getPreviousDecl();
|
TD = TD->getPreviousDecl();
|
||||||
}
|
}
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the most recent declaration.
|
// Use the most recent declaration.
|
||||||
|
@ -1219,7 +1219,7 @@ getExplicitVisibilityAux(const NamedDecl *ND,
|
||||||
return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
|
return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
|
||||||
kind);
|
kind);
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
// Also handle function template specializations.
|
// Also handle function template specializations.
|
||||||
if (const auto *fn = dyn_cast<FunctionDecl>(ND)) {
|
if (const auto *fn = dyn_cast<FunctionDecl>(ND)) {
|
||||||
|
@ -1236,14 +1236,14 @@ getExplicitVisibilityAux(const NamedDecl *ND,
|
||||||
if (InstantiatedFrom)
|
if (InstantiatedFrom)
|
||||||
return getVisibilityOf(InstantiatedFrom, kind);
|
return getVisibilityOf(InstantiatedFrom, kind);
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The visibility of a template is stored in the templated decl.
|
// The visibility of a template is stored in the templated decl.
|
||||||
if (const auto *TD = dyn_cast<TemplateDecl>(ND))
|
if (const auto *TD = dyn_cast<TemplateDecl>(ND))
|
||||||
return getVisibilityOf(TD->getTemplatedDecl(), kind);
|
return getVisibilityOf(TD->getTemplatedDecl(), kind);
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Visibility>
|
Optional<Visibility>
|
||||||
|
@ -5130,8 +5130,9 @@ IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
|
||||||
|
|
||||||
IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C,
|
IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C,
|
||||||
unsigned ID) {
|
unsigned ID) {
|
||||||
return new (C, ID) IndirectFieldDecl(C, nullptr, SourceLocation(),
|
return new (C, ID)
|
||||||
DeclarationName(), QualType(), None);
|
IndirectFieldDecl(C, nullptr, SourceLocation(), DeclarationName(),
|
||||||
|
QualType(), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceRange EnumConstantDecl::getSourceRange() const {
|
SourceRange EnumConstantDecl::getSourceRange() const {
|
||||||
|
@ -5362,7 +5363,7 @@ ImportDecl *ImportDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||||
|
|
||||||
ArrayRef<SourceLocation> ImportDecl::getIdentifierLocs() const {
|
ArrayRef<SourceLocation> ImportDecl::getIdentifierLocs() const {
|
||||||
if (!isImportComplete())
|
if (!isImportComplete())
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
const auto *StoredLocs = getTrailingObjects<SourceLocation>();
|
const auto *StoredLocs = getTrailingObjects<SourceLocation>();
|
||||||
return llvm::makeArrayRef(StoredLocs,
|
return llvm::makeArrayRef(StoredLocs,
|
||||||
|
|
|
@ -3139,7 +3139,8 @@ UsingPackDecl *UsingPackDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||||
unsigned NumExpansions) {
|
unsigned NumExpansions) {
|
||||||
size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
|
size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
|
||||||
auto *Result = new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, None);
|
auto *Result =
|
||||||
|
new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, std::nullopt);
|
||||||
Result->NumExpansions = NumExpansions;
|
Result->NumExpansions = NumExpansions;
|
||||||
auto *Trail = Result->getTrailingObjects<NamedDecl *>();
|
auto *Trail = Result->getTrailingObjects<NamedDecl *>();
|
||||||
for (unsigned I = 0; I != NumExpansions; ++I)
|
for (unsigned I = 0; I != NumExpansions; ++I)
|
||||||
|
@ -3277,7 +3278,7 @@ DecompositionDecl *DecompositionDecl::CreateDeserialized(ASTContext &C,
|
||||||
size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
|
size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
|
||||||
auto *Result = new (C, ID, Extra)
|
auto *Result = new (C, ID, Extra)
|
||||||
DecompositionDecl(C, nullptr, SourceLocation(), SourceLocation(),
|
DecompositionDecl(C, nullptr, SourceLocation(), SourceLocation(),
|
||||||
QualType(), nullptr, StorageClass(), None);
|
QualType(), nullptr, StorageClass(), std::nullopt);
|
||||||
// Set up and clean out the bindings array.
|
// Set up and clean out the bindings array.
|
||||||
Result->NumBindings = NumBindings;
|
Result->NumBindings = NumBindings;
|
||||||
auto *Trail = Result->getTrailingObjects<BindingDecl *>();
|
auto *Trail = Result->getTrailingObjects<BindingDecl *>();
|
||||||
|
|
|
@ -910,12 +910,12 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,
|
||||||
assert((!SelLocs.empty() || isImplicit()) &&
|
assert((!SelLocs.empty() || isImplicit()) &&
|
||||||
"No selector locs for non-implicit method");
|
"No selector locs for non-implicit method");
|
||||||
if (isImplicit())
|
if (isImplicit())
|
||||||
return setParamsAndSelLocs(C, Params, llvm::None);
|
return setParamsAndSelLocs(C, Params, std::nullopt);
|
||||||
|
|
||||||
setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params,
|
setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params,
|
||||||
DeclEndLoc));
|
DeclEndLoc));
|
||||||
if (getSelLocsKind() != SelLoc_NonStandard)
|
if (getSelLocsKind() != SelLoc_NonStandard)
|
||||||
return setParamsAndSelLocs(C, Params, llvm::None);
|
return setParamsAndSelLocs(C, Params, std::nullopt);
|
||||||
|
|
||||||
setParamsAndSelLocs(C, Params, SelLocs);
|
setParamsAndSelLocs(C, Params, SelLocs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
|
||||||
SourceLocation L,
|
SourceLocation L,
|
||||||
ArrayRef<Expr *> VL) {
|
ArrayRef<Expr *> VL) {
|
||||||
auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>(
|
auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>(
|
||||||
C, DC, llvm::None, VL.size(), L);
|
C, DC, std::nullopt, VL.size(), L);
|
||||||
D->setVars(VL);
|
D->setVars(VL);
|
||||||
return D;
|
return D;
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,9 +656,9 @@ TemplateTypeParmDecl::Create(const ASTContext &C, DeclContext *DC,
|
||||||
|
|
||||||
TemplateTypeParmDecl *
|
TemplateTypeParmDecl *
|
||||||
TemplateTypeParmDecl::CreateDeserialized(const ASTContext &C, unsigned ID) {
|
TemplateTypeParmDecl::CreateDeserialized(const ASTContext &C, unsigned ID) {
|
||||||
return new (C, ID) TemplateTypeParmDecl(nullptr, SourceLocation(),
|
return new (C, ID)
|
||||||
SourceLocation(), nullptr, false,
|
TemplateTypeParmDecl(nullptr, SourceLocation(), SourceLocation(), nullptr,
|
||||||
false, None);
|
false, false, std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateTypeParmDecl *
|
TemplateTypeParmDecl *
|
||||||
|
@ -666,8 +666,8 @@ TemplateTypeParmDecl::CreateDeserialized(const ASTContext &C, unsigned ID,
|
||||||
bool HasTypeConstraint) {
|
bool HasTypeConstraint) {
|
||||||
return new (C, ID,
|
return new (C, ID,
|
||||||
additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
|
additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
|
||||||
TemplateTypeParmDecl(nullptr, SourceLocation(), SourceLocation(),
|
TemplateTypeParmDecl(nullptr, SourceLocation(), SourceLocation(), nullptr,
|
||||||
nullptr, false, HasTypeConstraint, None);
|
false, HasTypeConstraint, std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation TemplateTypeParmDecl::getDefaultArgumentLoc() const {
|
SourceLocation TemplateTypeParmDecl::getDefaultArgumentLoc() const {
|
||||||
|
@ -781,12 +781,12 @@ NonTypeTemplateParmDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||||
unsigned NumExpandedTypes,
|
unsigned NumExpandedTypes,
|
||||||
bool HasTypeConstraint) {
|
bool HasTypeConstraint) {
|
||||||
auto *NTTP =
|
auto *NTTP =
|
||||||
new (C, ID, additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
|
new (C, ID,
|
||||||
Expr *>(
|
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>(
|
||||||
NumExpandedTypes, HasTypeConstraint ? 1 : 0))
|
NumExpandedTypes, HasTypeConstraint ? 1 : 0))
|
||||||
NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(),
|
NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(),
|
||||||
0, 0, nullptr, QualType(), nullptr, None,
|
0, 0, nullptr, QualType(), nullptr,
|
||||||
None);
|
std::nullopt, std::nullopt);
|
||||||
NTTP->NumExpandedTypes = NumExpandedTypes;
|
NTTP->NumExpandedTypes = NumExpandedTypes;
|
||||||
return NTTP;
|
return NTTP;
|
||||||
}
|
}
|
||||||
|
@ -854,7 +854,7 @@ TemplateTemplateParmDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||||
auto *TTP =
|
auto *TTP =
|
||||||
new (C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
|
new (C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
|
||||||
TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr,
|
TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr,
|
||||||
nullptr, None);
|
nullptr, std::nullopt);
|
||||||
TTP->NumExpandedParams = NumExpansions;
|
TTP->NumExpandedParams = NumExpansions;
|
||||||
return TTP;
|
return TTP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -647,7 +647,7 @@ std::string SYCLUniqueStableNameExpr::ComputeName(ASTContext &Context,
|
||||||
const NamedDecl *ND) -> llvm::Optional<unsigned> {
|
const NamedDecl *ND) -> llvm::Optional<unsigned> {
|
||||||
if (const auto *RD = dyn_cast<CXXRecordDecl>(ND))
|
if (const auto *RD = dyn_cast<CXXRecordDecl>(ND))
|
||||||
return RD->getDeviceLambdaManglingNumber();
|
return RD->getDeviceLambdaManglingNumber();
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<MangleContext> Ctx{ItaniumMangleContext::create(
|
std::unique_ptr<MangleContext> Ctx{ItaniumMangleContext::create(
|
||||||
|
@ -4533,7 +4533,8 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
|
||||||
OK_Ordinary) {
|
OK_Ordinary) {
|
||||||
BaseAndUpdaterExprs[0] = baseExpr;
|
BaseAndUpdaterExprs[0] = baseExpr;
|
||||||
|
|
||||||
InitListExpr *ILE = new (C) InitListExpr(C, lBraceLoc, None, rBraceLoc);
|
InitListExpr *ILE =
|
||||||
|
new (C) InitListExpr(C, lBraceLoc, std::nullopt, rBraceLoc);
|
||||||
ILE->setType(baseExpr->getType());
|
ILE->setType(baseExpr->getType());
|
||||||
BaseAndUpdaterExprs[1] = ILE;
|
BaseAndUpdaterExprs[1] = ILE;
|
||||||
|
|
||||||
|
|
|
@ -5680,7 +5680,7 @@ static Optional<DynamicType> ComputeDynamicType(EvalInfo &Info, const Expr *E,
|
||||||
// meaningful dynamic type. (We consider objects of non-class type to have no
|
// meaningful dynamic type. (We consider objects of non-class type to have no
|
||||||
// dynamic type.)
|
// dynamic type.)
|
||||||
if (!checkDynamicType(Info, E, This, AK, true))
|
if (!checkDynamicType(Info, E, This, AK, true))
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
// Refuse to compute a dynamic type in the presence of virtual bases. This
|
// Refuse to compute a dynamic type in the presence of virtual bases. This
|
||||||
// shouldn't happen other than in constant-folding situations, since literal
|
// shouldn't happen other than in constant-folding situations, since literal
|
||||||
|
@ -5692,7 +5692,7 @@ static Optional<DynamicType> ComputeDynamicType(EvalInfo &Info, const Expr *E,
|
||||||
This.Designator.MostDerivedType->getAsCXXRecordDecl();
|
This.Designator.MostDerivedType->getAsCXXRecordDecl();
|
||||||
if (!Class || Class->getNumVBases()) {
|
if (!Class || Class->getNumVBases()) {
|
||||||
Info.FFDiag(E);
|
Info.FFDiag(E);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: For very deep class hierarchies, it might be beneficial to use a
|
// FIXME: For very deep class hierarchies, it might be beneficial to use a
|
||||||
|
@ -5725,7 +5725,7 @@ static Optional<DynamicType> ComputeDynamicType(EvalInfo &Info, const Expr *E,
|
||||||
// 'This', so that object has not yet begun its period of construction and
|
// 'This', so that object has not yet begun its period of construction and
|
||||||
// any polymorphic operation on it results in undefined behavior.
|
// any polymorphic operation on it results in undefined behavior.
|
||||||
Info.FFDiag(E);
|
Info.FFDiag(E);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Perform virtual dispatch.
|
/// Perform virtual dispatch.
|
||||||
|
@ -6753,13 +6753,13 @@ static Optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
|
||||||
<< PointerAsString();
|
<< PointerAsString();
|
||||||
if (Pointer.Base)
|
if (Pointer.Base)
|
||||||
NoteLValueLocation(Info, Pointer.Base);
|
NoteLValueLocation(Info, Pointer.Base);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DynAlloc *> Alloc = Info.lookupDynamicAlloc(DA);
|
Optional<DynAlloc *> Alloc = Info.lookupDynamicAlloc(DA);
|
||||||
if (!Alloc) {
|
if (!Alloc) {
|
||||||
Info.FFDiag(E, diag::note_constexpr_double_delete);
|
Info.FFDiag(E, diag::note_constexpr_double_delete);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType AllocType = Pointer.Base.getDynamicAllocType();
|
QualType AllocType = Pointer.Base.getDynamicAllocType();
|
||||||
|
@ -6767,7 +6767,7 @@ static Optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
|
||||||
Info.FFDiag(E, diag::note_constexpr_new_delete_mismatch)
|
Info.FFDiag(E, diag::note_constexpr_new_delete_mismatch)
|
||||||
<< DeallocKind << (*Alloc)->getKind() << AllocType;
|
<< DeallocKind << (*Alloc)->getKind() << AllocType;
|
||||||
NoteLValueLocation(Info, Pointer.Base);
|
NoteLValueLocation(Info, Pointer.Base);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Subobject = false;
|
bool Subobject = false;
|
||||||
|
@ -6781,7 +6781,7 @@ static Optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
|
||||||
if (Subobject) {
|
if (Subobject) {
|
||||||
Info.FFDiag(E, diag::note_constexpr_delete_subobject)
|
Info.FFDiag(E, diag::note_constexpr_delete_subobject)
|
||||||
<< PointerAsString() << Pointer.Designator.isOnePastTheEnd();
|
<< PointerAsString() << Pointer.Designator.isOnePastTheEnd();
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Alloc;
|
return Alloc;
|
||||||
|
@ -7028,7 +7028,7 @@ public:
|
||||||
CharUnits DstSize = Info.Ctx.getTypeSizeInChars(BCE->getType());
|
CharUnits DstSize = Info.Ctx.getTypeSizeInChars(BCE->getType());
|
||||||
APValueToBufferConverter Converter(Info, DstSize, BCE);
|
APValueToBufferConverter Converter(Info, DstSize, BCE);
|
||||||
if (!Converter.visit(Src, BCE->getSubExpr()->getType()))
|
if (!Converter.visit(Src, BCE->getSubExpr()->getType()))
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Converter.Buffer;
|
return Converter.Buffer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7050,14 +7050,14 @@ class BufferToAPValueConverter {
|
||||||
Info.FFDiag(BCE->getBeginLoc(),
|
Info.FFDiag(BCE->getBeginLoc(),
|
||||||
diag::note_constexpr_bit_cast_unsupported_type)
|
diag::note_constexpr_bit_cast_unsupported_type)
|
||||||
<< Ty;
|
<< Ty;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::nullopt_t unrepresentableValue(QualType Ty, const APSInt &Val) {
|
std::nullopt_t unrepresentableValue(QualType Ty, const APSInt &Val) {
|
||||||
Info.FFDiag(BCE->getBeginLoc(),
|
Info.FFDiag(BCE->getBeginLoc(),
|
||||||
diag::note_constexpr_bit_cast_unrepresentable_value)
|
diag::note_constexpr_bit_cast_unrepresentable_value)
|
||||||
<< Ty << toString(Val, /*Radix=*/10);
|
<< Ty << toString(Val, /*Radix=*/10);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<APValue> visit(const BuiltinType *T, CharUnits Offset,
|
Optional<APValue> visit(const BuiltinType *T, CharUnits Offset,
|
||||||
|
@ -7097,7 +7097,7 @@ class BufferToAPValueConverter {
|
||||||
Info.FFDiag(BCE->getExprLoc(),
|
Info.FFDiag(BCE->getExprLoc(),
|
||||||
diag::note_constexpr_bit_cast_indet_dest)
|
diag::note_constexpr_bit_cast_indet_dest)
|
||||||
<< DisplayType << Info.Ctx.getLangOpts().CharIsSigned;
|
<< DisplayType << Info.Ctx.getLangOpts().CharIsSigned;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return APValue::IndeterminateValue();
|
return APValue::IndeterminateValue();
|
||||||
|
@ -7152,7 +7152,7 @@ class BufferToAPValueConverter {
|
||||||
Optional<APValue> SubObj = visitType(
|
Optional<APValue> SubObj = visitType(
|
||||||
BS.getType(), Layout.getBaseClassOffset(BaseDecl) + Offset);
|
BS.getType(), Layout.getBaseClassOffset(BaseDecl) + Offset);
|
||||||
if (!SubObj)
|
if (!SubObj)
|
||||||
return None;
|
return std::nullopt;
|
||||||
ResultVal.getStructBase(I) = *SubObj;
|
ResultVal.getStructBase(I) = *SubObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7165,7 +7165,7 @@ class BufferToAPValueConverter {
|
||||||
if (FD->isBitField()) {
|
if (FD->isBitField()) {
|
||||||
Info.FFDiag(BCE->getBeginLoc(),
|
Info.FFDiag(BCE->getBeginLoc(),
|
||||||
diag::note_constexpr_bit_cast_unsupported_bitfield);
|
diag::note_constexpr_bit_cast_unsupported_bitfield);
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FieldOffsetBits = Layout.getFieldOffset(FieldIdx);
|
uint64_t FieldOffsetBits = Layout.getFieldOffset(FieldIdx);
|
||||||
|
@ -7177,7 +7177,7 @@ class BufferToAPValueConverter {
|
||||||
QualType FieldTy = FD->getType();
|
QualType FieldTy = FD->getType();
|
||||||
Optional<APValue> SubObj = visitType(FieldTy, FieldOffset);
|
Optional<APValue> SubObj = visitType(FieldTy, FieldOffset);
|
||||||
if (!SubObj)
|
if (!SubObj)
|
||||||
return None;
|
return std::nullopt;
|
||||||
ResultVal.getStructField(FieldIdx) = *SubObj;
|
ResultVal.getStructField(FieldIdx) = *SubObj;
|
||||||
++FieldIdx;
|
++FieldIdx;
|
||||||
}
|
}
|
||||||
|
@ -7205,7 +7205,7 @@ class BufferToAPValueConverter {
|
||||||
Optional<APValue> ElementValue =
|
Optional<APValue> ElementValue =
|
||||||
visitType(Ty->getElementType(), Offset + I * ElementWidth);
|
visitType(Ty->getElementType(), Offset + I * ElementWidth);
|
||||||
if (!ElementValue)
|
if (!ElementValue)
|
||||||
return None;
|
return std::nullopt;
|
||||||
ArrayValue.getArrayInitializedElt(I) = std::move(*ElementValue);
|
ArrayValue.getArrayInitializedElt(I) = std::move(*ElementValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10571,7 +10571,7 @@ static llvm::Optional<APValue> handleVectorUnaryOperator(ASTContext &Ctx,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// FIXME: Implement the rest of the unary operators.
|
// FIXME: Implement the rest of the unary operators.
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15943,7 +15943,7 @@ Optional<llvm::APSInt> Expr::getIntegerConstantExpr(const ASTContext &Ctx,
|
||||||
bool isEvaluated) const {
|
bool isEvaluated) const {
|
||||||
if (isValueDependent()) {
|
if (isValueDependent()) {
|
||||||
// Expression evaluator can't succeed on a dependent expression.
|
// Expression evaluator can't succeed on a dependent expression.
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
APSInt Value;
|
APSInt Value;
|
||||||
|
@ -15951,11 +15951,11 @@ Optional<llvm::APSInt> Expr::getIntegerConstantExpr(const ASTContext &Ctx,
|
||||||
if (Ctx.getLangOpts().CPlusPlus11) {
|
if (Ctx.getLangOpts().CPlusPlus11) {
|
||||||
if (EvaluateCPlusPlus11IntegralConstantExpr(Ctx, this, &Value, Loc))
|
if (EvaluateCPlusPlus11IntegralConstantExpr(Ctx, this, &Value, Loc))
|
||||||
return Value;
|
return Value;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isIntegerConstantExpr(Ctx, Loc))
|
if (!isIntegerConstantExpr(Ctx, Loc))
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
// The only possible side-effects here are due to UB discovered in the
|
// The only possible side-effects here are due to UB discovered in the
|
||||||
// evaluation (for instance, INT_MAX + 1). In such a case, we are still
|
// evaluation (for instance, INT_MAX + 1). In such a case, we are still
|
||||||
|
|
|
@ -32,7 +32,7 @@ ExternalASTSource::~ExternalASTSource() = default;
|
||||||
|
|
||||||
llvm::Optional<ASTSourceDescriptor>
|
llvm::Optional<ASTSourceDescriptor>
|
||||||
ExternalASTSource::getSourceDescriptor(unsigned ID) {
|
ExternalASTSource::getSourceDescriptor(unsigned ID) {
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalASTSource::ExtKind
|
ExternalASTSource::ExtKind
|
||||||
|
|
|
@ -740,7 +740,7 @@ ConversionSpecifier::getStandardSpecifier() const {
|
||||||
|
|
||||||
switch (getKind()) {
|
switch (getKind()) {
|
||||||
default:
|
default:
|
||||||
return None;
|
return std::nullopt;
|
||||||
case DArg:
|
case DArg:
|
||||||
NewKind = dArg;
|
NewKind = dArg;
|
||||||
break;
|
break;
|
||||||
|
@ -1041,7 +1041,7 @@ Optional<LengthModifier> FormatSpecifier::getCorrectedLengthModifier() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FormatSpecifier::namedTypeToLengthModifier(QualType QT,
|
bool FormatSpecifier::namedTypeToLengthModifier(QualType QT,
|
||||||
|
|
|
@ -96,7 +96,7 @@ Optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) {
|
||||||
if (LHSTombstone || RHSTombstone)
|
if (LHSTombstone || RHSTombstone)
|
||||||
return LHSTombstone && RHSTombstone;
|
return LHSTombstone && RHSTombstone;
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -6560,7 +6560,7 @@ ItaniumMangleContext *ItaniumMangleContext::create(ASTContext &Context,
|
||||||
return new ItaniumMangleContextImpl(
|
return new ItaniumMangleContextImpl(
|
||||||
Context, Diags,
|
Context, Diags,
|
||||||
[](ASTContext &, const NamedDecl *) -> llvm::Optional<unsigned> {
|
[](ASTContext &, const NamedDecl *) -> llvm::Optional<unsigned> {
|
||||||
return llvm::None;
|
return std::nullopt;
|
||||||
},
|
},
|
||||||
IsAux);
|
IsAux);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ class LinkageComputer {
|
||||||
LVComputationKind Kind) const {
|
LVComputationKind Kind) const {
|
||||||
auto Iter = CachedLinkageInfo.find(makeCacheKey(ND, Kind));
|
auto Iter = CachedLinkageInfo.find(makeCacheKey(ND, Kind));
|
||||||
if (Iter == CachedLinkageInfo.end())
|
if (Iter == CachedLinkageInfo.end())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Iter->second;
|
return Iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ public:
|
||||||
void mangleBits(llvm::APInt Number);
|
void mangleBits(llvm::APInt Number);
|
||||||
void mangleTagTypeKind(TagTypeKind TK);
|
void mangleTagTypeKind(TagTypeKind TK);
|
||||||
void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName,
|
void mangleArtificialTagType(TagTypeKind TK, StringRef UnqualifiedName,
|
||||||
ArrayRef<StringRef> NestedNames = None);
|
ArrayRef<StringRef> NestedNames = std::nullopt);
|
||||||
void mangleAddressSpaceType(QualType T, Qualifiers Quals, SourceRange Range);
|
void mangleAddressSpaceType(QualType T, Qualifiers Quals, SourceRange Range);
|
||||||
void mangleType(QualType T, SourceRange Range,
|
void mangleType(QualType T, SourceRange Range,
|
||||||
QualifierMangleMode QMM = QMM_Mangle);
|
QualifierMangleMode QMM = QMM_Mangle);
|
||||||
|
|
|
@ -149,7 +149,7 @@ Optional<NSAPI::NSArrayMethodKind> NSAPI::getNSArrayMethodKind(Selector Sel) {
|
||||||
return MK;
|
return MK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Selector NSAPI::getNSDictionarySelector(
|
Selector NSAPI::getNSDictionarySelector(
|
||||||
|
@ -251,7 +251,7 @@ NSAPI::getNSDictionaryMethodKind(Selector Sel) {
|
||||||
return MK;
|
return MK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Selector NSAPI::getNSSetSelector(NSSetMethodKind MK) const {
|
Selector NSAPI::getNSSetSelector(NSSetMethodKind MK) const {
|
||||||
|
@ -308,7 +308,7 @@ NSAPI::getNSSetMethodKind(Selector Sel) {
|
||||||
return MK;
|
return MK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Selector NSAPI::getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK,
|
Selector NSAPI::getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK,
|
||||||
|
@ -371,14 +371,14 @@ NSAPI::getNSNumberLiteralMethodKind(Selector Sel) const {
|
||||||
return MK;
|
return MK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<NSAPI::NSNumberLiteralMethodKind>
|
Optional<NSAPI::NSNumberLiteralMethodKind>
|
||||||
NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
|
NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
|
||||||
const BuiltinType *BT = T->getAs<BuiltinType>();
|
const BuiltinType *BT = T->getAs<BuiltinType>();
|
||||||
if (!BT)
|
if (!BT)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
const TypedefType *TDT = T->getAs<TypedefType>();
|
const TypedefType *TDT = T->getAs<TypedefType>();
|
||||||
if (TDT) {
|
if (TDT) {
|
||||||
|
@ -496,7 +496,7 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if \param T is a typedef of "BOOL" in objective-c.
|
/// Returns true if \param T is a typedef of "BOOL" in objective-c.
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ bool IfStmt::isObjCAvailabilityCheck() const {
|
||||||
|
|
||||||
Optional<Stmt *> IfStmt::getNondiscardedCase(const ASTContext &Ctx) {
|
Optional<Stmt *> IfStmt::getNondiscardedCase(const ASTContext &Ctx) {
|
||||||
if (!isConstexpr() || getCond()->isValueDependent())
|
if (!isConstexpr() || getCond()->isValueDependent())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return !getCond()->EvaluateKnownConstInt(Ctx) ? getElse() : getThen();
|
return !getCond()->EvaluateKnownConstInt(Ctx) ? getElse() : getThen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ IfStmt::getNondiscardedCase(const ASTContext &Ctx) const {
|
||||||
if (Optional<Stmt *> Result =
|
if (Optional<Stmt *> Result =
|
||||||
const_cast<IfStmt *>(this)->getNondiscardedCase(Ctx))
|
const_cast<IfStmt *>(this)->getNondiscardedCase(Ctx))
|
||||||
return *Result;
|
return *Result;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForStmt::ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
ForStmt::ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
||||||
|
|
|
@ -517,7 +517,7 @@ OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
|
||||||
Stmt *AssociatedStmt,
|
Stmt *AssociatedStmt,
|
||||||
bool HasCancel) {
|
bool HasCancel) {
|
||||||
auto *Dir =
|
auto *Dir =
|
||||||
createDirective<OMPSectionDirective>(C, llvm::None, AssociatedStmt,
|
createDirective<OMPSectionDirective>(C, std::nullopt, AssociatedStmt,
|
||||||
/*NumChildren=*/0, StartLoc, EndLoc);
|
/*NumChildren=*/0, StartLoc, EndLoc);
|
||||||
Dir->setHasCancel(HasCancel);
|
Dir->setHasCancel(HasCancel);
|
||||||
return Dir;
|
return Dir;
|
||||||
|
@ -550,7 +550,7 @@ OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
|
||||||
SourceLocation StartLoc,
|
SourceLocation StartLoc,
|
||||||
SourceLocation EndLoc,
|
SourceLocation EndLoc,
|
||||||
Stmt *AssociatedStmt) {
|
Stmt *AssociatedStmt) {
|
||||||
return createDirective<OMPMasterDirective>(C, llvm::None, AssociatedStmt,
|
return createDirective<OMPMasterDirective>(C, std::nullopt, AssociatedStmt,
|
||||||
/*NumChildren=*/0, StartLoc,
|
/*NumChildren=*/0, StartLoc,
|
||||||
EndLoc);
|
EndLoc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,7 @@ Optional<unsigned> TemplateArgument::getNumTemplateExpansions() const {
|
||||||
if (TemplateArg.NumExpansions)
|
if (TemplateArg.NumExpansions)
|
||||||
return TemplateArg.NumExpansions - 1;
|
return TemplateArg.NumExpansions - 1;
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType TemplateArgument::getNonTypeTemplateArgumentType() const {
|
QualType TemplateArgument::getNonTypeTemplateArgumentType() const {
|
||||||
|
|
|
@ -1527,23 +1527,23 @@ Optional<ArrayRef<QualType>> Type::getObjCSubstitutions(
|
||||||
// substitution to do.
|
// substitution to do.
|
||||||
dcTypeParams = dcClassDecl->getTypeParamList();
|
dcTypeParams = dcClassDecl->getTypeParamList();
|
||||||
if (!dcTypeParams)
|
if (!dcTypeParams)
|
||||||
return None;
|
return std::nullopt;
|
||||||
} else {
|
} else {
|
||||||
// If we are in neither a class nor a category, there's no
|
// If we are in neither a class nor a category, there's no
|
||||||
// substitution to perform.
|
// substitution to perform.
|
||||||
dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
|
dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
|
||||||
if (!dcCategoryDecl)
|
if (!dcCategoryDecl)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
// If the category does not have any type parameters, there's no
|
// If the category does not have any type parameters, there's no
|
||||||
// substitution to do.
|
// substitution to do.
|
||||||
dcTypeParams = dcCategoryDecl->getTypeParamList();
|
dcTypeParams = dcCategoryDecl->getTypeParamList();
|
||||||
if (!dcTypeParams)
|
if (!dcTypeParams)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
dcClassDecl = dcCategoryDecl->getClassInterface();
|
dcClassDecl = dcCategoryDecl->getClassInterface();
|
||||||
if (!dcClassDecl)
|
if (!dcClassDecl)
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
assert(dcTypeParams && "No substitutions to perform");
|
assert(dcTypeParams && "No substitutions to perform");
|
||||||
assert(dcClassDecl && "No class context");
|
assert(dcClassDecl && "No class context");
|
||||||
|
@ -4153,7 +4153,7 @@ Type::getNullability(const ASTContext &Context) const {
|
||||||
|
|
||||||
Type = AT->getEquivalentType();
|
Type = AT->getEquivalentType();
|
||||||
}
|
}
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::canHaveNullability(bool ResultIfUnknown) const {
|
bool Type::canHaveNullability(bool ResultIfUnknown) const {
|
||||||
|
@ -4294,7 +4294,7 @@ AttributedType::getImmediateNullability() const {
|
||||||
return NullabilityKind::Unspecified;
|
return NullabilityKind::Unspecified;
|
||||||
if (getAttrKind() == attr::TypeNullableResult)
|
if (getAttrKind() == attr::TypeNullableResult)
|
||||||
return NullabilityKind::NullableResult;
|
return NullabilityKind::NullableResult;
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<NullabilityKind> AttributedType::stripOuterNullability(QualType &T) {
|
Optional<NullabilityKind> AttributedType::stripOuterNullability(QualType &T) {
|
||||||
|
@ -4309,7 +4309,7 @@ Optional<NullabilityKind> AttributedType::stripOuterNullability(QualType &T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::isBlockCompatibleObjCPointerType(ASTContext &ctx) const {
|
bool Type::isBlockCompatibleObjCPointerType(ASTContext &ctx) const {
|
||||||
|
|
Loading…
Reference in New Issue