diff options
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 99e5edb9d4a3..bd55f7179399 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -178,8 +178,7 @@ void Parser::CheckNestedObjCContexts(SourceLocation AtLoc) Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); if (Decl) - Diag(Decl->getLocStart(), diag::note_objc_container_start) - << (int) ock; + Diag(Decl->getBeginLoc(), diag::note_objc_container_start) << (int)ock; } /// @@ -264,7 +263,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc, categoryId = Tok.getIdentifierInfo(); categoryLoc = ConsumeToken(); } - else if (!getLangOpts().ObjC2) { + else if (!getLangOpts().ObjC) { Diag(Tok, diag::err_expected) << tok::identifier; // missing category name. return nullptr; @@ -384,12 +383,12 @@ static void addContextSensitiveTypeNullability(Parser &P, if (D.getNumTypeObjects() > 0) { // Add the attribute to the declarator chunk nearest the declarator. - D.getTypeObject(0).getAttrs().addAtStart( + D.getTypeObject(0).getAttrs().addAtEnd( getNullabilityAttr(D.getAttributePool())); } else if (!addedToDeclSpec) { // Otherwise, just put it on the declaration specifiers (if one // isn't there already). - D.getMutableDeclSpec().getAttributes().addAtStart( + D.getMutableDeclSpec().getAttributes().addAtEnd( getNullabilityAttr(D.getMutableDeclSpec().getAttributes().getPool())); addedToDeclSpec = true; } @@ -690,8 +689,8 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, case tok::objc_interface: Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) - << (int) Actions.getObjCContainerKind(); + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) + << (int)Actions.getObjCContainerKind(); ConsumeToken(); break; @@ -706,7 +705,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, break; case tok::objc_property: - if (!getLangOpts().ObjC2) + if (!getLangOpts().ObjC) Diag(AtLoc, diag::err_objc_properties_require_objc2); ObjCDeclSpec OCDS; @@ -776,8 +775,8 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, } else { Diag(Tok, diag::err_objc_missing_end) << FixItHint::CreateInsertion(Tok.getLocation(), "\n@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) - << (int) Actions.getObjCContainerKind(); + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) + << (int)Actions.getObjCContainerKind(); AtEnd.setBegin(Tok.getLocation()); AtEnd.setEnd(Tok.getLocation()); } @@ -1104,7 +1103,7 @@ bool Parser::isTokIdentifier_in() const { // FIXME: May have to do additional look-ahead to only allow for // valid tokens following an 'in'; such as an identifier, unary operators, // '[' etc. - return (getLangOpts().ObjC2 && Tok.is(tok::identifier) && + return (getLangOpts().ObjC && Tok.is(tok::identifier) && Tok.getIdentifierInfo() == ObjCTypeQuals[objc_in]); } @@ -1198,7 +1197,7 @@ static void takeDeclAttributes(ParsedAttributesView &attrs, for (auto &AL : llvm::reverse(from)) { if (!AL.isUsedAsTypeAttr()) { from.remove(&AL); - attrs.addAtStart(&AL); + attrs.addAtEnd(&AL); } } } @@ -1338,7 +1337,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the method, parse them. ParsedAttributes methodAttrs(AttrFactory); - if (getLangOpts().ObjC2) + if (getLangOpts().ObjC) MaybeParseGNUAttributes(methodAttrs); MaybeParseCXX11Attributes(methodAttrs); @@ -1365,7 +1364,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo; if (Tok.isNot(tok::colon)) { // If attributes exist after the method, parse them. - if (getLangOpts().ObjC2) + if (getLangOpts().ObjC) MaybeParseGNUAttributes(methodAttrs); MaybeParseCXX11Attributes(methodAttrs); @@ -1401,7 +1400,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the argument name, parse them. // Regardless, collect all the attributes we've parsed so far. - if (getLangOpts().ObjC2) + if (getLangOpts().ObjC) MaybeParseGNUAttributes(paramAttrs); MaybeParseCXX11Attributes(paramAttrs); ArgInfo.ArgAttrs = paramAttrs; @@ -1485,7 +1484,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // FIXME: Add support for optional parameter list... // If attributes exist after the method, parse them. - if (getLangOpts().ObjC2) + if (getLangOpts().ObjC) MaybeParseGNUAttributes(methodAttrs); MaybeParseCXX11Attributes(methodAttrs); @@ -1551,7 +1550,7 @@ ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &Protocols, TypeResult Parser::parseObjCProtocolQualifierType(SourceLocation &rAngleLoc) { assert(Tok.is(tok::less) && "Protocol qualifiers start with '<'"); - assert(getLangOpts().ObjC1 && "Protocol qualifiers only exist in Objective-C"); + assert(getLangOpts().ObjC && "Protocol qualifiers only exist in Objective-C"); SourceLocation lAngleLoc; SmallVector<Decl *, 8> protocols; @@ -2223,7 +2222,7 @@ Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() { if (P.isEofOrEom()) { P.Diag(P.Tok, diag::err_objc_missing_end) << FixItHint::CreateInsertion(P.Tok.getLocation(), "\n@end\n"); - P.Diag(Dcl->getLocStart(), diag::note_objc_container_start) + P.Diag(Dcl->getBeginLoc(), diag::note_objc_container_start) << Sema::OCK_Implementation; } } @@ -2742,7 +2741,7 @@ StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) { // Otherwise, eat the semicolon. ExpectAndConsumeSemi(diag::err_expected_semi_after_expr); - return Actions.ActOnExprStmt(Res); + return Actions.ActOnExprStmt(Res, isExprValueDiscarded()); } ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) { @@ -2946,14 +2945,14 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { /// This routine will only return true for a subset of valid message-send /// expressions. bool Parser::isSimpleObjCMessageExpression() { - assert(Tok.is(tok::l_square) && getLangOpts().ObjC1 && + assert(Tok.is(tok::l_square) && getLangOpts().ObjC && "Incorrect start for isSimpleObjCMessageExpression"); return GetLookAheadToken(1).is(tok::identifier) && GetLookAheadToken(2).is(tok::identifier); } bool Parser::isStartOfObjCClassMessageMissingOpenBracket() { - if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) || + if (!getLangOpts().ObjC || !NextToken().is(tok::identifier) || InMessageExpression) return false; |