Skip to content

Commit 43cfad6

Browse files
committed
[clang-format][NFC] Add is_sorted() assertion for binary_search()
1 parent 25e218d commit 43cfad6

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

clang/lib/Format/Format.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3158,6 +3158,7 @@ class ObjCHeaderStyleGuesser : public TokenAnalyzer {
31583158
"UIImage",
31593159
"UIView",
31603160
};
3161+
assert(llvm::is_sorted(FoundationIdentifiers));
31613162

31623163
for (auto *Line : AnnotatedLines) {
31633164
if (Line->First && (Line->First->TokenText.starts_with("#") ||

clang/lib/Format/FormatToken.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static SmallVector<StringRef> CppNonKeywordTypes = {
4343
bool FormatToken::isTypeName(const LangOptions &LangOpts) const {
4444
if (is(TT_TypeName) || Tok.isSimpleTypeSpecifier(LangOpts))
4545
return true;
46+
assert(llvm::is_sorted(CppNonKeywordTypes));
4647
return (LangOpts.CXXOperatorNames || LangOpts.C11) && is(tok::identifier) &&
4748
llvm::binary_search(CppNonKeywordTypes, TokenText);
4849
}

0 commit comments

Comments
 (0)