@@ -3498,7 +3498,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
3498
3498
assert (!OriginalModuleName.empty ());
3499
3499
assert (!PlatformAndVersions.empty ());
3500
3500
assert (NK == NextSegmentKind::PlatformVersion);
3501
- AttrRange = SourceRange (Loc, Tok. getLoc () );
3501
+ AttrRange = SourceRange (Loc, RightLoc );
3502
3502
for (auto &Item: PlatformAndVersions) {
3503
3503
Attributes.add (new (Context) OriginallyDefinedInAttr (AtLoc, AttrRange,
3504
3504
OriginalModuleName,
@@ -3944,28 +3944,30 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
3944
3944
return makeParserSuccess ();
3945
3945
}
3946
3946
3947
- if (!consumeIf (tok::r_paren)) {
3947
+ SourceLoc rParenLoc;
3948
+ if (!consumeIf (tok::r_paren, rParenLoc)) {
3948
3949
diagnose (Tok.getLoc (), diag::attr_expected_rparen,
3949
3950
AttrName, /* isModifier*/ false );
3950
3951
return makeParserSuccess ();
3951
3952
}
3952
3953
3953
3954
attr = new (Context) RawLayoutAttr (size, align,
3954
- AtLoc, SourceRange (Loc, Tok. getLoc () ));
3955
+ AtLoc, SourceRange (Loc, rParenLoc ));
3955
3956
} else if (firstLabel.is (" like" )) {
3956
3957
// @_rawLayout(like: T)
3957
3958
auto likeType = parseType (diag::expected_type);
3958
3959
if (likeType.isNull ()) {
3959
3960
return makeParserSuccess ();
3960
3961
}
3961
- if (!consumeIf (tok::r_paren)) {
3962
+ SourceLoc rParenLoc;
3963
+ if (!consumeIf (tok::r_paren, rParenLoc)) {
3962
3964
diagnose (Tok.getLoc (), diag::attr_expected_rparen,
3963
3965
AttrName, /* isModifier*/ false );
3964
3966
return makeParserSuccess ();
3965
3967
}
3966
3968
3967
3969
attr = new (Context) RawLayoutAttr (likeType.get (),
3968
- AtLoc, SourceRange (Loc, Tok. getLoc () ));
3970
+ AtLoc, SourceRange (Loc, rParenLoc ));
3969
3971
} else if (firstLabel.is (" likeArrayOf" )) {
3970
3972
// @_rawLayout(likeArrayOf: T, count: N)
3971
3973
auto likeType = parseType (diag::expected_type);
@@ -4003,14 +4005,15 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
4003
4005
return makeParserSuccess ();
4004
4006
}
4005
4007
4006
- if (!consumeIf (tok::r_paren)) {
4008
+ SourceLoc rParenLoc;
4009
+ if (!consumeIf (tok::r_paren, rParenLoc)) {
4007
4010
diagnose (Tok.getLoc (), diag::attr_expected_rparen,
4008
4011
AttrName, /* isModifier*/ false );
4009
4012
return makeParserSuccess ();
4010
4013
}
4011
4014
4012
4015
attr = new (Context) RawLayoutAttr (likeType.get (), count,
4013
- AtLoc, SourceRange (Loc, Tok. getLoc () ));
4016
+ AtLoc, SourceRange (Loc, rParenLoc ));
4014
4017
} else {
4015
4018
diagnose (Loc, diag::attr_rawlayout_expected_label,
4016
4019
" 'size', 'like', or 'likeArrayOf'" );
0 commit comments