File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1103,17 +1103,19 @@ Parser::DeclGroupPtrTy Parser::ParseDeclOrFunctionDefInternal(
11031103 // Suggest correct location to fix '[[attrib]] struct' to 'struct
11041104 // [[attrib]]'
11051105 SourceLocation CorrectLocationForAttributes{};
1106- auto TKind = DS.getTypeSpecType ();
1106+ TypeSpecifierType TKind = DS.getTypeSpecType ();
11071107 if (DeclSpec::isDeclRep (TKind)) {
11081108 if (TKind == DeclSpec::TST_enum) {
1109- const auto *ED = dyn_cast_or_null<EnumDecl>(DS.getRepAsDecl ());
1110- if (ED) {
1109+ if (const auto *ED = dyn_cast_or_null<EnumDecl>(DS.getRepAsDecl ())) {
11111110 if (ED->getIdentifier ()) {
11121111 CorrectLocationForAttributes = ED->getLocation ();
11131112 } else {
11141113 const auto Begin = ED->getBraceRange ().getBegin ();
11151114 CorrectLocationForAttributes =
1116- Begin.isValid () ? Begin : ED->getEndLoc ();
1115+ Begin.isValid () ? Begin :
1116+ // If there is no brace, fall back to the end
1117+ // location, which corresponds to the semicolon.
1118+ ED->getEndLoc ();
11171119 }
11181120 }
11191121 }
You can’t perform that action at this time.
0 commit comments