[Clang][Parse][NFC] Use llvm::function_ref<> instead of std::optional<llvm::function_ref<>> (#142906)
There is no need to distinguish between null `optional` and null `function_ref` in this case.
This commit is contained in:
@@ -2598,8 +2598,7 @@ private:
|
||||
void ParseTypeQualifierListOpt(
|
||||
DeclSpec &DS, unsigned AttrReqs = AR_AllAttributesParsed,
|
||||
bool AtomicOrPtrauthAllowed = true, bool IdentifierRequired = false,
|
||||
std::optional<llvm::function_ref<void()>> CodeCompletionHandler =
|
||||
std::nullopt);
|
||||
llvm::function_ref<void()> CodeCompletionHandler = {});
|
||||
|
||||
/// ParseDirectDeclarator
|
||||
/// \verbatim
|
||||
|
||||
@@ -6124,8 +6124,7 @@ bool Parser::isConstructorDeclarator(bool IsUnqualified, bool DeductionGuide,
|
||||
|
||||
void Parser::ParseTypeQualifierListOpt(
|
||||
DeclSpec &DS, unsigned AttrReqs, bool AtomicOrPtrauthAllowed,
|
||||
bool IdentifierRequired,
|
||||
std::optional<llvm::function_ref<void()>> CodeCompletionHandler) {
|
||||
bool IdentifierRequired, llvm::function_ref<void()> CodeCompletionHandler) {
|
||||
if ((AttrReqs & AR_CXX11AttributesParsed) &&
|
||||
isAllowedCXX11AttributeSpecifier()) {
|
||||
ParsedAttributes Attrs(AttrFactory);
|
||||
@@ -6145,7 +6144,7 @@ void Parser::ParseTypeQualifierListOpt(
|
||||
case tok::code_completion:
|
||||
cutOffParsing();
|
||||
if (CodeCompletionHandler)
|
||||
(*CodeCompletionHandler)();
|
||||
CodeCompletionHandler();
|
||||
else
|
||||
Actions.CodeCompletion().CodeCompleteTypeQualifiers(DS);
|
||||
return;
|
||||
@@ -7236,9 +7235,9 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
|
||||
ParseTypeQualifierListOpt(
|
||||
DS, AR_NoAttributesParsed,
|
||||
/*AtomicOrPtrauthAllowed=*/false,
|
||||
/*IdentifierRequired=*/false, llvm::function_ref<void()>([&]() {
|
||||
/*IdentifierRequired=*/false, [&]() {
|
||||
Actions.CodeCompletion().CodeCompleteFunctionQualifiers(DS, D);
|
||||
}));
|
||||
});
|
||||
if (!DS.getSourceRange().getEnd().isInvalid()) {
|
||||
EndLoc = DS.getSourceRange().getEnd();
|
||||
}
|
||||
|
||||
@@ -2649,9 +2649,9 @@ void Parser::MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(
|
||||
// handled by the caller. Diagnose everything else.
|
||||
ParseTypeQualifierListOpt(
|
||||
DS, AR_NoAttributesParsed, /*AtomicOrPtrauthAllowed=*/false,
|
||||
/*IdentifierRequired=*/false, llvm::function_ref<void()>([&]() {
|
||||
/*IdentifierRequired=*/false, [&]() {
|
||||
Actions.CodeCompletion().CodeCompleteFunctionQualifiers(DS, D, &VS);
|
||||
}));
|
||||
});
|
||||
D.ExtendWithDeclSpec(DS);
|
||||
|
||||
if (D.isFunctionDeclarator()) {
|
||||
|
||||
Reference in New Issue
Block a user