// may get this far before the problem becomes obvious.
if (DS.hasTagDefinition() &&
DiagnoseMissingSemiAfterTagDefinition(DS, AS_none, DSContext))
- return DeclGroupPtrTy();
+ return nullptr;
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
// Bail out if the first declarator didn't seem well-formed.
if (!D.hasName() && !D.mayOmitIdentifier()) {
SkipMalformedDecl();
- return DeclGroupPtrTy();
+ return nullptr;
}
// Save late-parsed attributes for now; they need to be parsed in the
} else {
Diag(Tok, diag::err_expected_fn_body);
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
} else {
if (Tok.is(tok::l_brace)) {
Diag(Tok, diag::err_function_definition_not_allowed);
SkipMalformedDecl();
- return DeclGroupPtrTy();
+ return nullptr;
}
}
}
if (ParseAsmAttributesAfterDeclarator(D))
- return DeclGroupPtrTy();
+ return nullptr;
// C++0x [stmt.iter]p1: Check if we have a for-range-declarator. If so, we
// must parse and analyze the for-range-initializer before the declaration is
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteNamespaceDecl(getCurScope());
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
SourceLocation IdentLoc;
Diag(Tok, diag::err_expected) << tok::identifier;
// Skip to end of the definition and eat the ';'.
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
if (attrLoc.isValid())
Diag(attrLoc, diag::err_unexpected_namespace_attributes_alias);
Diag(Tok, diag::err_expected) << tok::l_brace;
else
Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;
- return DeclGroupPtrTy();
+ return nullptr;
}
if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||
getCurScope()->getFnParent()) {
Diag(T.getOpenLocation(), diag::err_namespace_nonnamespace_scope);
SkipUntil(tok::r_brace);
- return DeclGroupPtrTy();
+ return nullptr;
}
if (ExtraIdent.empty()) {
ConsumeToken();
SkipUntil(tok::r_brace, StopAtSemi);
- return DeclGroupPtrTy();
+ return nullptr;
}
// Turn on colon protection early, while parsing declspec, although there is
if (SS.isInvalid()) {
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
// Try to parse an unqualified-id.
if (ParseUnqualifiedId(SS, false, true, true, ParsedType(),
TemplateKWLoc, Name)) {
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
// TODO: recover from mistakenly-qualified operator declarations.
if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"access declaration")) {
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
return DeclGroupPtrTy::make(DeclGroupRef(Actions.ActOnUsingDeclaration(
if (Tok.is(tok::kw_namespace)) {
Diag(UsingLoc, diag::err_using_namespace_in_class);
SkipUntil(tok::semi, StopBeforeMatch);
- return DeclGroupPtrTy();
+ return nullptr;
}
SourceLocation DeclEnd;
// Otherwise, it must be a using-declaration or an alias-declaration.
TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate &&
DiagnoseMissingSemiAfterTagDefinition(DS, AS, DSC_class,
&CommonLateParsedAttrs))
- return DeclGroupPtrTy();
+ return nullptr;
MultiTemplateParamsArg TemplateParams(
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data()
if (ParseCXXMemberDeclaratorBeforeInitializer(
DeclaratorInfo, VS, BitfieldSize, LateParsedAttrs)) {
TryConsumeToken(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
// Check for a member function definition.
// Consume the optional ';'
TryConsumeToken(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
// If we stopped at a ';', eat it.
TryConsumeToken(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
return Actions.FinalizeDeclaratorGroup(getCurScope(), DS, DeclsInGroup);
if (getLangOpts().MicrosoftExt &&
Tok.isOneOf(tok::kw___if_exists, tok::kw___if_not_exists)) {
ParseMicrosoftIfExistsClassDeclaration(TagType, AS);
- return DeclGroupPtrTy();
+ return nullptr;
}
// Check for extraneous top-level semicolon.
if (Tok.is(tok::semi)) {
ConsumeExtraSemi(InsideStruct, TagType);
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_vis)) {
HandlePragmaVisibility();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_pack)) {
HandlePragmaPack();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_align)) {
HandlePragmaAlign();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_ms_pointers_to_members)) {
HandlePragmaMSPointersToMembers();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_ms_pragma)) {
HandlePragmaMSPragma();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_ms_vtordisp)) {
HandlePragmaMSVtorDisp();
- return DeclGroupPtrTy();
+ return nullptr;
}
// If we see a namespace here, a close brace was missing somewhere.
if (Tok.is(tok::kw_namespace)) {
DiagnoseUnexpectedNamespace(cast<NamedDecl>(TagDecl));
- return DeclGroupPtrTy();
+ return nullptr;
}
AccessSpecifier NewAS = getAccessSpecifierIfPresent();
AccessAttrs.clear();
}
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::annot_pragma_openmp))
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCAtDirective(getCurScope());
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
Decl *SingleDecl = nullptr;
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCProtocolDecl(getCurScope());
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
MaybeSkipAttributes(tok::objc_protocol);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier; // missing protocol name.
- return DeclGroupPtrTy();
+ return nullptr;
}
// Save the protocol name, then consume it.
IdentifierInfo *protocolName = Tok.getIdentifierInfo();
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
ProtocolRefs.push_back(IdentifierLocPair(Tok.getIdentifierInfo(),
Tok.getLocation()));
}
// Consume the ';'.
if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@protocol"))
- return DeclGroupPtrTy();
+ return nullptr;
return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtocolRefs,
attrs.getList());
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false, true,
LAngleLoc, EndProtoLoc,
/*consumeLastToken=*/true))
- return DeclGroupPtrTy();
+ return nullptr;
Decl *ProtoType =
Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc,
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCImplementationDecl(getCurScope());
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
MaybeSkipAttributes(tok::objc_implementation);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing class or category name.
- return DeclGroupPtrTy();
+ return nullptr;
}
// We have a class or category name - consume it.
IdentifierInfo *nameId = Tok.getIdentifierInfo();
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCImplementationCategory(getCurScope(), nameId, nameLoc);
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.is(tok::identifier)) {
} else {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing category name.
- return DeclGroupPtrTy();
+ return nullptr;
}
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected) << tok::r_paren;
SkipUntil(tok::r_paren); // don't stop at ';'
- return DeclGroupPtrTy();
+ return nullptr;
}
rparenLoc = ConsumeParen();
if (Tok.is(tok::less)) { // we have illegal '<' try to recover
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing super class name.
- return DeclGroupPtrTy();
+ return nullptr;
}
superClassId = Tok.getIdentifierInfo();
superClassLoc = ConsumeToken(); // Consume super class name
else
// missing @implementation
Diag(atEnd.getBegin(), diag::err_expected_objc_container);
- return DeclGroupPtrTy();
+ return nullptr;
}
Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() {
break;
}
SkipUntil(tok::annot_pragma_openmp_end);
- return DeclGroupPtrTy();
+ return nullptr;
}
/// \brief Parsing of declarative or executable OpenMP directives.
ConsumeToken(); // consume 'in'
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteObjCForCollection(getCurScope(), DeclGroupPtrTy());
+ Actions.CodeCompleteObjCForCollection(getCurScope(), nullptr);
cutOffParsing();
return StmtError();
}
if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
ConsumeToken();
- Result = DeclGroupPtrTy();
+ Result = nullptr;
switch (Tok.getKind()) {
case tok::annot_pragma_unused:
HandlePragmaUnused();
if (PP.isCodeCompletionReached()) {
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
Decl *SingleDecl = nullptr;
switch (Tok.getKind()) {
case tok::annot_pragma_vis:
HandlePragmaVisibility();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_pack:
HandlePragmaPack();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_msstruct:
HandlePragmaMSStruct();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_align:
HandlePragmaAlign();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_weak:
HandlePragmaWeak();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_weakalias:
HandlePragmaWeakAlias();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_redefine_extname:
HandlePragmaRedefineExtname();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_fp_contract:
HandlePragmaFPContract();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_opencl_extension:
HandlePragmaOpenCLExtension();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_openmp:
return ParseOpenMPDeclarativeDirective();
case tok::annot_pragma_ms_pointers_to_members:
HandlePragmaMSPointersToMembers();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_ms_vtordisp:
HandlePragmaMSVtorDisp();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_ms_pragma:
HandlePragmaMSPragma();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::annot_pragma_dump:
HandlePragmaDump();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::semi:
// Either a C++11 empty-declaration or attribute-declaration.
SingleDecl = Actions.ActOnEmptyDeclaration(getCurScope(),
case tok::r_brace:
Diag(Tok, diag::err_extraneous_closing_brace);
ConsumeBrace();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::eof:
Diag(Tok, diag::err_expected_external_declaration);
- return DeclGroupPtrTy();
+ return nullptr;
case tok::kw___extension__: {
// __extension__ silences extension warnings in the subexpression.
ExtensionRAIIObject O(Diags); // Use RAII to do this.
"top-level asm block");
if (Result.isInvalid())
- return DeclGroupPtrTy();
+ return nullptr;
SingleDecl = Actions.ActOnFileScopeAsmDecl(Result.get(), StartLoc, EndLoc);
break;
}
if (!getLangOpts().ObjC1) {
Diag(Tok, diag::err_expected_external_declaration);
ConsumeToken();
- return DeclGroupPtrTy();
+ return nullptr;
}
SingleDecl = ParseObjCMethodDefinition();
break;
CurParsedObjCImpl? Sema::PCC_ObjCImplementation
: Sema::PCC_Namespace);
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
case tok::kw_using:
case tok::kw_namespace:
case tok::kw_typedef:
case tok::kw___if_exists:
case tok::kw___if_not_exists:
ParseMicrosoftIfExistsExternalDeclaration();
- return DeclGroupPtrTy();
-
+ return nullptr;
+
default:
dont_know:
// We can't tell whether this is a function-definition or declaration yet.
// may get this far before the problem becomes obvious.
if (DS.hasTagDefinition() &&
DiagnoseMissingSemiAfterTagDefinition(DS, AS, DSC_top_level))
- return DeclGroupPtrTy();
+ return nullptr;
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
!Tok.isObjCAtKeyword(tok::objc_protocol)) {
Diag(Tok, diag::err_objc_unexpected_attr);
SkipUntil(tok::semi); // FIXME: better skip?
- return DeclGroupPtrTy();
+ return nullptr;
}
DS.abort();
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteModuleImport(ImportLoc, Path);
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
Diag(Tok, diag::err_module_expected_ident);
SkipUntil(tok::semi);
- return DeclGroupPtrTy();
+ return nullptr;
}
// Record this part of the module path.
if (PP.hadModuleLoaderFatalFailure()) {
// With a fatal failure in the module loader, we abort parsing.
cutOffParsing();
- return DeclGroupPtrTy();
+ return nullptr;
}
DeclResult Import = Actions.ActOnModuleImport(AtLoc, ImportLoc, Path);
ExpectAndConsumeSemi(diag::err_module_expected_semi);
if (Import.isInvalid())
- return DeclGroupPtrTy();
-
+ return nullptr;
+
return Actions.ConvertDeclToDeclGroup(Import.get());
}
CurContext->addDecl(D);
return DeclGroupPtrTy::make(DeclGroupRef(D));
}
- return DeclGroupPtrTy();
+ return nullptr;
}
namespace {