[clang-tools-extra] [clang-tidy] Prefer the faster LLVM ADT sets and maps over `std::` ones (PR #174357)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 5 07:14:30 PST 2026
================
@@ -70,12 +70,13 @@ static FixItHint getCallFixItHint(const ObjCMessageExpr *Expr,
StringRef Receiver =
getReceiverString(Expr->getReceiverRange(), SM, LangOpts);
// Some classes should use standard factory methods instead of alloc/init.
- std::map<StringRef, StringRef> ClassToFactoryMethodMap = {{"NSDate", "date"},
- {"NSNull", "null"}};
- auto FoundClassFactory = ClassToFactoryMethodMap.find(Receiver);
- if (FoundClassFactory != ClassToFactoryMethodMap.end()) {
- StringRef ClassName = FoundClassFactory->first;
- StringRef FactorySelector = FoundClassFactory->second;
+ static constexpr std::pair<StringRef, StringRef> ClassToFactoryMethodMap[] = {
----------------
EugeneZelenko wrote:
Please include `utility` instead of `map`.
https://github.com/llvm/llvm-project/pull/174357
More information about the cfe-commits
mailing list