mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-14 17:06:38 +00:00
[clang-reorder-fields] Avoid repeated hash lookups (NFC) (#127165)
This commit is contained in:
parent
55b0fde20a
commit
5be4536d09
@ -70,11 +70,12 @@ getNewFieldsOrder(const RecordDecl *Definition,
|
||||
}
|
||||
SmallVector<unsigned, 4> NewFieldsOrder;
|
||||
for (const auto &Name : DesiredFieldsOrder) {
|
||||
if (!NameToIndex.count(Name)) {
|
||||
auto It = NameToIndex.find(Name);
|
||||
if (It == NameToIndex.end()) {
|
||||
llvm::errs() << "Field " << Name << " not found in definition.\n";
|
||||
return {};
|
||||
}
|
||||
NewFieldsOrder.push_back(NameToIndex[Name]);
|
||||
NewFieldsOrder.push_back(It->second);
|
||||
}
|
||||
assert(NewFieldsOrder.size() == NameToIndex.size());
|
||||
return NewFieldsOrder;
|
||||
|
Loading…
x
Reference in New Issue
Block a user