Skip to content

Commit 2b06658

Browse files
committed
[CLANG] Move microsoft attrs into loop
1 parent 517ba9e commit 2b06658

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/include/clang/Parse/Parser.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3056,13 +3056,16 @@ class Parser : public CodeCompletionHandler {
30563056
bool CouldBeBitField = false);
30573057
Decl *ParseHLSLBuffer(SourceLocation &DeclEnd);
30583058

3059-
void MaybeParseMicrosoftAttributes(ParsedAttributes &Attrs) {
3059+
bool MaybeParseMicrosoftAttributes(ParsedAttributes &Attrs) {
3060+
bool AttrsParsed = false;
30603061
if ((getLangOpts().MicrosoftExt || getLangOpts().HLSL) &&
30613062
Tok.is(tok::l_square)) {
30623063
ParsedAttributes AttrsWithRange(AttrFactory);
30633064
ParseMicrosoftAttributes(AttrsWithRange);
3065+
AttrsParsed = AttrsWithRange.size();
30643066
Attrs.takeAllFrom(AttrsWithRange);
30653067
}
3068+
return AttrsParsed;
30663069
}
30673070
void ParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs);
30683071
void ParseMicrosoftAttributes(ParsedAttributes &Attrs);

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,12 +3037,12 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration(
30373037
ParsedAttributes DeclSpecAttrs(AttrFactory);
30383038
// Hold late-parsed attributes so we can attach a Decl to them later.
30393039
LateParsedAttrList CommonLateParsedAttrs;
3040+
30403041
while (MaybeParseCXX11Attributes(DeclAttrs) ||
3041-
MaybeParseGNUAttributes(DeclSpecAttrs, &CommonLateParsedAttrs)) {
3042+
MaybeParseGNUAttributes(DeclSpecAttrs, &CommonLateParsedAttrs) ||
3043+
MaybeParseMicrosoftAttributes(DeclSpecAttrs)) {
30423044
}
30433045

3044-
MaybeParseMicrosoftAttributes(DeclSpecAttrs);
3045-
30463046
// decl-specifier-seq:
30473047
// Parse the common declaration-specifiers piece.
30483048
ParsingDeclSpec DS(*this, TemplateDiags);

0 commit comments

Comments
 (0)