Skip to content

Commit a495ee9

Browse files
committed
cleanup, add additional comment
1 parent 9f93393 commit a495ee9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/Parse/Parser.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)