Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2598,8 +2598,7 @@ class Parser : public CodeCompletionHandler {
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
Expand Down
9 changes: 4 additions & 5 deletions clang/lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -6145,7 +6144,7 @@ void Parser::ParseTypeQualifierListOpt(
case tok::code_completion:
cutOffParsing();
if (CodeCompletionHandler)
(*CodeCompletionHandler)();
CodeCompletionHandler();
else
Actions.CodeCompletion().CodeCompleteTypeQualifiers(DS);
return;
Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Loading