Skip to content

Commit 280609c

Browse files
committed
[clang-format][NFC] Minor improvement to FormatToken::isTypeName()
1 parent f73f5af commit 280609c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/lib/Format/FormatToken.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ static SmallVector<StringRef> CppNonKeywordTypes = {
4242
};
4343

4444
bool FormatToken::isTypeName(const LangOptions &LangOpts) const {
45+
if (is(TT_TypeName) || Tok.isSimpleTypeSpecifier(LangOpts))
46+
return true;
4547
const bool IsCpp = LangOpts.CXXOperatorNames;
46-
return is(TT_TypeName) || Tok.isSimpleTypeSpecifier(LangOpts) ||
47-
(IsCpp && is(tok::identifier) &&
48-
std::binary_search(CppNonKeywordTypes.begin(),
49-
CppNonKeywordTypes.end(), TokenText));
48+
return IsCpp && is(tok::identifier) &&
49+
std::binary_search(CppNonKeywordTypes.begin(),
50+
CppNonKeywordTypes.end(), TokenText);
5051
}
5152

5253
bool FormatToken::isTypeOrIdentifier(const LangOptions &LangOpts) const {

0 commit comments

Comments
 (0)