Skip to content

Commit 6201874

Browse files
committed
Apply feedback
- Inline `found` boolean. - Improve comment wording - Use foreach loop instead of classic index loop.
1 parent 87e7ec3 commit 6201874

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/tools/llvm-nm/llvm-nm.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,13 +1617,12 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO,
16171617
// See if these addresses are already in the symbol table.
16181618
unsigned FunctionStartsAdded = 0;
16191619
SmallSet<uint64_t, 32> SymbolAddresses;
1620-
for (unsigned J = 0; J < SymbolList.size(); ++J)
1621-
SymbolAddresses.insert(SymbolList[J].Address);
1620+
for (const auto &S : SymbolList)
1621+
SymbolAddresses.insert(S.Address);
16221622
for (uint64_t f = 0; f < FoundFns.size(); f++) {
1623-
bool found = SymbolAddresses.contains(FoundFns[f] + BaseSegmentAddress);
1624-
// See this address is not already in the symbol table fake up an
1625-
// nlist for it.
1626-
if (!found) {
1623+
// See if this address is already in the symbol table, otherwise fake up
1624+
// an nlist for it.
1625+
if (!SymbolAddresses.contains(FoundFns[f] + BaseSegmentAddress)) {
16271626
NMSymbol F = {};
16281627
F.Name = "<redacted function X>";
16291628
F.Address = FoundFns[f] + BaseSegmentAddress;

0 commit comments

Comments
 (0)