Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -31,6 +31,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Lex/Lexer.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" @@ -1446,8 +1447,7 @@ private: static bool guessIsObjC(const SmallVectorImpl &AnnotatedLines, const AdditionalKeywords &Keywords) { - // Keep this array sorted, since we are binary searching over it. - static constexpr llvm::StringLiteral FoundationIdentifiers[] = { + static const auto *FoundationIdentifiers = new llvm::DenseSet{ "CGFloat", "NSAffineTransform", "NSArray", @@ -1510,9 +1510,8 @@ FormatTok->isOneOf(tok::numeric_constant, tok::l_square, tok::l_brace))) || (FormatTok->Tok.isAnyIdentifier() && - std::binary_search(std::begin(FoundationIdentifiers), - std::end(FoundationIdentifiers), - FormatTok->TokenText)) || + FoundationIdentifiers->find(FormatTok->TokenText) != + FoundationIdentifiers->end()) || FormatTok->is(TT_ObjCStringLiteral) || FormatTok->isOneOf(Keywords.kw_NS_ENUM, Keywords.kw_NS_OPTIONS, TT_ObjCBlockLBrace, TT_ObjCBlockLParen,