@@ -3498,7 +3498,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
34983498 assert (!OriginalModuleName.empty ());
34993499 assert (!PlatformAndVersions.empty ());
35003500 assert (NK == NextSegmentKind::PlatformVersion);
3501- AttrRange = SourceRange (Loc, Tok. getLoc () );
3501+ AttrRange = SourceRange (Loc, RightLoc );
35023502 for (auto &Item: PlatformAndVersions) {
35033503 Attributes.add (new (Context) OriginallyDefinedInAttr (AtLoc, AttrRange,
35043504 OriginalModuleName,
@@ -3944,28 +3944,30 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
39443944 return makeParserSuccess ();
39453945 }
39463946
3947- if (!consumeIf (tok::r_paren)) {
3947+ SourceLoc rParenLoc;
3948+ if (!consumeIf (tok::r_paren, rParenLoc)) {
39483949 diagnose (Tok.getLoc (), diag::attr_expected_rparen,
39493950 AttrName, /* isModifier*/ false );
39503951 return makeParserSuccess ();
39513952 }
39523953
39533954 attr = new (Context) RawLayoutAttr (size, align,
3954- AtLoc, SourceRange (Loc, Tok. getLoc () ));
3955+ AtLoc, SourceRange (Loc, rParenLoc ));
39553956 } else if (firstLabel.is (" like" )) {
39563957 // @_rawLayout(like: T)
39573958 auto likeType = parseType (diag::expected_type);
39583959 if (likeType.isNull ()) {
39593960 return makeParserSuccess ();
39603961 }
3961- if (!consumeIf (tok::r_paren)) {
3962+ SourceLoc rParenLoc;
3963+ if (!consumeIf (tok::r_paren, rParenLoc)) {
39623964 diagnose (Tok.getLoc (), diag::attr_expected_rparen,
39633965 AttrName, /* isModifier*/ false );
39643966 return makeParserSuccess ();
39653967 }
39663968
39673969 attr = new (Context) RawLayoutAttr (likeType.get (),
3968- AtLoc, SourceRange (Loc, Tok. getLoc () ));
3970+ AtLoc, SourceRange (Loc, rParenLoc ));
39693971 } else if (firstLabel.is (" likeArrayOf" )) {
39703972 // @_rawLayout(likeArrayOf: T, count: N)
39713973 auto likeType = parseType (diag::expected_type);
@@ -4003,14 +4005,15 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
40034005 return makeParserSuccess ();
40044006 }
40054007
4006- if (!consumeIf (tok::r_paren)) {
4008+ SourceLoc rParenLoc;
4009+ if (!consumeIf (tok::r_paren, rParenLoc)) {
40074010 diagnose (Tok.getLoc (), diag::attr_expected_rparen,
40084011 AttrName, /* isModifier*/ false );
40094012 return makeParserSuccess ();
40104013 }
40114014
40124015 attr = new (Context) RawLayoutAttr (likeType.get (), count,
4013- AtLoc, SourceRange (Loc, Tok. getLoc () ));
4016+ AtLoc, SourceRange (Loc, rParenLoc ));
40144017 } else {
40154018 diagnose (Loc, diag::attr_rawlayout_expected_label,
40164019 " 'size', 'like', or 'likeArrayOf'" );
0 commit comments