98 ArrayRef<std::pair<llvm::Constant *, llvm::Constant *>> KeysAndObjects,
100 Opts =
static_cast<uint64_t
>(O);
101 uint64_t
const NumElements = KeysAndObjects.size();
104 Elements.reserve(NumElements);
108 std::iota(ElementIndicies.begin(), ElementIndicies.end(), 0);
112 ElementIndicies.begin(), ElementIndicies.end(),
113 [E, O](
size_t LI,
size_t RI) {
114 Expr *const LK = E->getKeyValueElement(LI).Key->IgnoreImpCasts();
115 Expr *const RK = E->getKeyValueElement(RI).Key->IgnoreImpCasts();
117 if (!isa<ObjCStringLiteral>(LK) || !isa<ObjCStringLiteral>(RK))
118 llvm_unreachable(
"Non-constant literals should not be sorted to "
119 "maintain existing behavior");
123 StringRef LKS = cast<ObjCStringLiteral>(LK)->getString()->getString();
124 StringRef RKS = cast<ObjCStringLiteral>(RK)->getString()->getString();
128 if (O == Options::Sorted)
130 llvm_unreachable(
"Unexpected `NSDictionaryBuilder::Options given");
134 for (
auto &Idx : ElementIndicies) {
135 Elements.push_back(KeysAndObjects[Idx]);