@@ -144,27 +144,17 @@ void StringTableBuilder::finalizeStringTable(bool Optimize) {
144144 for (StringPair &P : StringIndexMap)
145145 Strings.push_back (&P);
146146
147- auto getStringPriority = [this ](const CachedHashStringRef Str) -> uint8_t {
148- if (StringPriorityMap.contains (Str))
149- return StringPriorityMap[Str];
150- return 0 ;
151- };
152-
153147 size_t RangeBegin = 0 ;
154148 MutableArrayRef<StringPair *> StringsRef (Strings);
155149 if (StringPriorityMap.size ()) {
156150 llvm::sort (Strings,
157151 [&](const StringPair *LHS, const StringPair *RHS) -> bool {
158- return getStringPriority (LHS->first ) >
159- getStringPriority (RHS->first );
152+ return StringPriorityMap. lookup (LHS->first ) >
153+ StringPriorityMap. lookup (RHS->first );
160154 });
161- // Make sure ArrayRef is valid. Although std::sort implementaion is
162- // normally in-place , it is not guaranteed by standard.
163- StringsRef = Strings;
164-
165- uint8_t RangePriority = getStringPriority (Strings[0 ]->first );
155+ uint8_t RangePriority = StringPriorityMap.lookup (Strings[0 ]->first );
166156 for (size_t I = 1 , E = Strings.size (); I != E && RangePriority; ++I) {
167- uint8_t Priority = getStringPriority (Strings[I]->first );
157+ uint8_t Priority = StringPriorityMap. lookup (Strings[I]->first );
168158 if (Priority != RangePriority) {
169159 multikeySort (StringsRef.slice (RangeBegin, I - RangeBegin), 0 );
170160 RangePriority = Priority;
0 commit comments