Author: dblaikie Date: Fri Jan 15 17:43:25 2016 New Revision: 257956 URL: http://llvm.org/viewvc/llvm-project?rev=257956&view=rev Log: OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedef
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/lib/Parse/ParseObjc.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Parse/ParseStmt.cpp cfe/trunk/lib/Parse/Parser.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Parse/ParseDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDecl.cpp (original) +++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Jan 15 17:43:25 2016 @@ -1522,7 +1522,7 @@ Parser::ParseSimpleDeclaration(unsigned // 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] ';' @@ -1701,7 +1701,7 @@ Parser::DeclGroupPtrTy Parser::ParseDecl // 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 @@ -1766,19 +1766,19 @@ Parser::DeclGroupPtrTy Parser::ParseDecl } 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 Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Jan 15 17:43:25 2016 @@ -65,7 +65,7 @@ Parser::DeclGroupPtrTy Parser::ParseName if (Tok.is(tok::code_completion)) { Actions.CodeCompleteNamespaceDecl(getCurScope()); cutOffParsing(); - return DeclGroupPtrTy(); + return nullptr; } SourceLocation IdentLoc; @@ -109,7 +109,7 @@ Parser::DeclGroupPtrTy Parser::ParseName 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); @@ -126,7 +126,7 @@ Parser::DeclGroupPtrTy Parser::ParseName 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() || @@ -134,7 +134,7 @@ Parser::DeclGroupPtrTy Parser::ParseName getCurScope()->getFnParent()) { Diag(T.getOpenLocation(), diag::err_namespace_nonnamespace_scope); SkipUntil(tok::r_brace); - return DeclGroupPtrTy(); + return nullptr; } if (ExtraIdent.empty()) { @@ -2253,7 +2253,7 @@ Parser::ParseCXXClassMemberDeclaration(A ConsumeToken(); SkipUntil(tok::r_brace, StopAtSemi); - return DeclGroupPtrTy(); + return nullptr; } // Turn on colon protection early, while parsing declspec, although there is @@ -2287,7 +2287,7 @@ Parser::ParseCXXClassMemberDeclaration(A if (SS.isInvalid()) { SkipUntil(tok::semi); - return DeclGroupPtrTy(); + return nullptr; } // Try to parse an unqualified-id. @@ -2296,14 +2296,14 @@ Parser::ParseCXXClassMemberDeclaration(A 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( @@ -2361,7 +2361,7 @@ Parser::ParseCXXClassMemberDeclaration(A 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. @@ -2391,7 +2391,7 @@ Parser::ParseCXXClassMemberDeclaration(A TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate && DiagnoseMissingSemiAfterTagDefinition(DS, AS, DSC_class, &CommonLateParsedAttrs)) - return DeclGroupPtrTy(); + return nullptr; MultiTemplateParamsArg TemplateParams( TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() @@ -2446,7 +2446,7 @@ Parser::ParseCXXClassMemberDeclaration(A if (ParseCXXMemberDeclaratorBeforeInitializer( DeclaratorInfo, VS, BitfieldSize, LateParsedAttrs)) { TryConsumeToken(tok::semi); - return DeclGroupPtrTy(); + return nullptr; } // Check for a member function definition. @@ -2495,7 +2495,7 @@ Parser::ParseCXXClassMemberDeclaration(A // Consume the optional ';' TryConsumeToken(tok::semi); - return DeclGroupPtrTy(); + return nullptr; } if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) { @@ -2698,7 +2698,7 @@ Parser::ParseCXXClassMemberDeclaration(A 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); @@ -2825,49 +2825,49 @@ Parser::DeclGroupPtrTy Parser::ParseCXXC 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(); @@ -2903,7 +2903,7 @@ Parser::DeclGroupPtrTy Parser::ParseCXXC AccessAttrs.clear(); } - return DeclGroupPtrTy(); + return nullptr; } if (Tok.is(tok::annot_pragma_openmp)) Modified: cfe/trunk/lib/Parse/ParseObjc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseObjc.cpp (original) +++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Jan 15 17:43:25 2016 @@ -50,7 +50,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjC if (Tok.is(tok::code_completion)) { Actions.CodeCompleteObjCAtDirective(getCurScope()); cutOffParsing(); - return DeclGroupPtrTy(); + return nullptr; } Decl *SingleDecl = nullptr; @@ -2005,14 +2005,14 @@ Parser::ParseObjCAtProtocolDeclaration(S 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(); @@ -2036,7 +2036,7 @@ Parser::ParseObjCAtProtocolDeclaration(S 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())); @@ -2047,7 +2047,7 @@ Parser::ParseObjCAtProtocolDeclaration(S } // Consume the ';'. if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@protocol")) - return DeclGroupPtrTy(); + return nullptr; return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtocolRefs, attrs.getList()); @@ -2062,7 +2062,7 @@ Parser::ParseObjCAtProtocolDeclaration(S ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false, true, LAngleLoc, EndProtoLoc, /*consumeLastToken=*/true)) - return DeclGroupPtrTy(); + return nullptr; Decl *ProtoType = Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc, @@ -2096,7 +2096,7 @@ Parser::ParseObjCAtImplementationDeclara if (Tok.is(tok::code_completion)) { Actions.CodeCompleteObjCImplementationDecl(getCurScope()); cutOffParsing(); - return DeclGroupPtrTy(); + return nullptr; } MaybeSkipAttributes(tok::objc_implementation); @@ -2104,7 +2104,7 @@ Parser::ParseObjCAtImplementationDeclara 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(); @@ -2137,7 +2137,7 @@ Parser::ParseObjCAtImplementationDeclara if (Tok.is(tok::code_completion)) { Actions.CodeCompleteObjCImplementationCategory(getCurScope(), nameId, nameLoc); cutOffParsing(); - return DeclGroupPtrTy(); + return nullptr; } if (Tok.is(tok::identifier)) { @@ -2146,12 +2146,12 @@ Parser::ParseObjCAtImplementationDeclara } 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 @@ -2178,7 +2178,7 @@ Parser::ParseObjCAtImplementationDeclara 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 @@ -2232,7 +2232,7 @@ Parser::ParseObjCAtEndDeclaration(Source else // missing @implementation Diag(atEnd.getBegin(), diag::err_expected_objc_container); - return DeclGroupPtrTy(); + return nullptr; } Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() { Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Fri Jan 15 17:43:25 2016 @@ -146,7 +146,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen break; } SkipUntil(tok::annot_pragma_openmp_end); - return DeclGroupPtrTy(); + return nullptr; } /// \brief Parsing of declarative or executable OpenMP directives. Modified: cfe/trunk/lib/Parse/ParseStmt.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseStmt.cpp (original) +++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Jan 15 17:43:25 2016 @@ -1632,7 +1632,7 @@ StmtResult Parser::ParseForStatement(Sou ConsumeToken(); // consume 'in' if (Tok.is(tok::code_completion)) { - Actions.CodeCompleteObjCForCollection(getCurScope(), DeclGroupPtrTy()); + Actions.CodeCompleteObjCForCollection(getCurScope(), nullptr); cutOffParsing(); return StmtError(); } Modified: cfe/trunk/lib/Parse/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Parse/Parser.cpp (original) +++ cfe/trunk/lib/Parse/Parser.cpp Fri Jan 15 17:43:25 2016 @@ -545,7 +545,7 @@ bool Parser::ParseTopLevelDecl(DeclGroup if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof)) ConsumeToken(); - Result = DeclGroupPtrTy(); + Result = nullptr; switch (Tok.getKind()) { case tok::annot_pragma_unused: HandlePragmaUnused(); @@ -625,52 +625,52 @@ Parser::ParseExternalDeclaration(ParsedA 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(), @@ -681,10 +681,10 @@ Parser::ParseExternalDeclaration(ParsedA 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. @@ -712,7 +712,7 @@ Parser::ParseExternalDeclaration(ParsedA "top-level asm block"); if (Result.isInvalid()) - return DeclGroupPtrTy(); + return nullptr; SingleDecl = Actions.ActOnFileScopeAsmDecl(Result.get(), StartLoc, EndLoc); break; } @@ -723,7 +723,7 @@ Parser::ParseExternalDeclaration(ParsedA if (!getLangOpts().ObjC1) { Diag(Tok, diag::err_expected_external_declaration); ConsumeToken(); - return DeclGroupPtrTy(); + return nullptr; } SingleDecl = ParseObjCMethodDefinition(); break; @@ -732,7 +732,7 @@ Parser::ParseExternalDeclaration(ParsedA CurParsedObjCImpl? Sema::PCC_ObjCImplementation : Sema::PCC_Namespace); cutOffParsing(); - return DeclGroupPtrTy(); + return nullptr; case tok::kw_using: case tok::kw_namespace: case tok::kw_typedef: @@ -796,8 +796,8 @@ Parser::ParseExternalDeclaration(ParsedA 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. @@ -876,7 +876,7 @@ Parser::ParseDeclOrFunctionDefInternal(P // 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] ';' @@ -899,7 +899,7 @@ Parser::ParseDeclOrFunctionDefInternal(P !Tok.isObjCAtKeyword(tok::objc_protocol)) { Diag(Tok, diag::err_objc_unexpected_attr); SkipUntil(tok::semi); // FIXME: better skip? - return DeclGroupPtrTy(); + return nullptr; } DS.abort(); @@ -1990,12 +1990,12 @@ Parser::DeclGroupPtrTy Parser::ParseModu 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. @@ -2013,14 +2013,14 @@ Parser::DeclGroupPtrTy Parser::ParseModu 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()); } Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=257956&r1=257955&r2=257956&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jan 15 17:43:25 2016 @@ -1141,7 +1141,7 @@ Sema::ActOnOpenMPThreadprivateDirective( CurContext->addDecl(D); return DeclGroupPtrTy::make(DeclGroupRef(D)); } - return DeclGroupPtrTy(); + return nullptr; } namespace { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits