110 ArrayRef<std::pair<llvm::Constant *, llvm::Constant *>> KeysAndObjects,
112 Opts =
static_cast<uint64_t
>(O);
113 uint64_t
const NumElements = KeysAndObjects.size();
116 Elements.reserve(NumElements);
120 std::iota(ElementIndicies.begin(), ElementIndicies.end(), 0);
124 ElementIndicies.begin(), ElementIndicies.end(),
125 [E, O](
size_t LI,
size_t RI) {
126 Expr *const LK = E->getKeyValueElement(LI).Key->IgnoreImpCasts();
127 Expr *const RK = E->getKeyValueElement(RI).Key->IgnoreImpCasts();
129 if (!isa<ObjCStringLiteral>(LK) || !isa<ObjCStringLiteral>(RK))
130 llvm_unreachable(
"Non-constant literals should not be sorted to "
131 "maintain existing behavior");
135 StringRef LKS = cast<ObjCStringLiteral>(LK)->getString()->getString();
136 StringRef RKS = cast<ObjCStringLiteral>(RK)->getString()->getString();
140 if (O == Options::Sorted)
142 llvm_unreachable(
"Unexpected `NSDictionaryBuilder::Options given");
146 for (
auto &Idx : ElementIndicies) {
147 Elements.push_back(KeysAndObjects[Idx]);