// symbols at offset zero within the section (which is typically the case with
// .subsections_via_symbols.)
auto hasUnwind = [](Defined *d) { return d->unwindEntry != nullptr; };
- auto itA = std::find_if(ia->symbols.begin(), ia->symbols.end(), hasUnwind);
- auto itB = std::find_if(ib->symbols.begin(), ib->symbols.end(), hasUnwind);
+ const auto *itA =
+ std::find_if(ia->symbols.begin(), ia->symbols.end(), hasUnwind);
+ const auto *itB =
+ std::find_if(ib->symbols.begin(), ib->symbols.end(), hasUnwind);
if (itA == ia->symbols.end())
return itB == ib->symbols.end();
if (itB == ib->symbols.end())
if (auto *sym = r.referent.dyn_cast<Symbol *>()) {
if (auto *defined = dyn_cast<Defined>(sym)) {
if (defined->isec) {
- if (auto referentIsec =
+ if (auto *referentIsec =
dyn_cast<ConcatInputSection>(defined->isec))
hash += defined->value + referentIsec->icfEqClass[icfPass % 2];
else
return "<internal>";
// Multiple dylibs can be defined in one .tbd file.
- if (auto dylibFile = dyn_cast<DylibFile>(f))
+ if (const auto *dylibFile = dyn_cast<DylibFile>(f))
if (f->getName().endswith(".tbd"))
return (f->getName() + "(" + dylibFile->installName + ")").str();
StringRef aliasedName = StringRef(strtab + sym.n_value);
// isPrivateExtern is the only symbol flag that has an impact on the final
// aliased symbol.
- auto alias = make<AliasSymbol>(this, name, aliasedName, isPrivateExtern);
+ auto *alias = make<AliasSymbol>(this, name, aliasedName, isPrivateExtern);
aliases.push_back(alias);
return alias;
}
make_pointee_range(currentTopLevelTapi->documents())) {
assert(child.documents().empty());
if (path == child.getInstallName()) {
- auto file = make<DylibFile>(child, umbrella, /*isBundleLoader=*/false,
- /*explicitlyLinked=*/false);
+ auto *file = make<DylibFile>(child, umbrella, /*isBundleLoader=*/false,
+ /*explicitlyLinked=*/false);
file->parseReexports(child);
return file;
}
error(toString(this) +
": dylib has both LC_DYLD_INFO_ONLY and LC_DYLD_EXPORTS_TRIE");
return;
- } else if (dyldInfo) {
+ }
+
+ if (dyldInfo) {
parseExportedSymbols(dyldInfo->export_off, dyldInfo->export_size);
} else if (exportsTrie) {
parseExportedSymbols(exportsTrie->dataoff, exportsTrie->datasize);
} else {
error("No LC_DYLD_INFO_ONLY or LC_DYLD_EXPORTS_TRIE found in " +
toString(this));
- return;
}
}
// the suggested symbol, which is either in the symbol table, or in the same
// file of sym.
static const Symbol *getAlternativeSpelling(const Undefined &sym,
- std::string &pre_hint,
- std::string &post_hint) {
+ std::string &preHint,
+ std::string &postHint) {
DenseMap<StringRef, const Symbol *> map;
if (sym.getFile() && sym.getFile()->kind() == InputFile::ObjKind) {
// Build a map of local defined symbols.
const Symbol *s = suggest((Twine("_") + buf).str());
free(buf);
if (s) {
- pre_hint = ": extern \"C\" ";
+ preHint = ": extern \"C\" ";
return s;
}
}
} else {
- StringRef name_without_underscore = name;
- name_without_underscore.consume_front("_");
+ StringRef nameWithoutUnderscore = name;
+ nameWithoutUnderscore.consume_front("_");
const Symbol *s = nullptr;
for (auto &it : map)
- if (canSuggestExternCForCXX(name_without_underscore, it.first)) {
+ if (canSuggestExternCForCXX(nameWithoutUnderscore, it.first)) {
s = it.second;
break;
}
if (!s)
for (Symbol *sym : symtab->getSymbols())
- if (canSuggestExternCForCXX(name_without_underscore, sym->getName())) {
+ if (canSuggestExternCForCXX(nameWithoutUnderscore, sym->getName())) {
s = sym;
break;
}
if (s) {
- pre_hint = " to declare ";
- post_hint = " as extern \"C\"?";
+ preHint = " to declare ";
+ postHint = " as extern \"C\"?";
return s;
}
}
.str();
if (correctSpelling) {
- std::string pre_hint = ": ", post_hint;
+ std::string preHint = ": ", postHint;
if (const Symbol *corrected =
- getAlternativeSpelling(sym, pre_hint, post_hint)) {
+ getAlternativeSpelling(sym, preHint, postHint)) {
message +=
- "\n>>> did you mean" + pre_hint + toString(*corrected) + post_hint;
+ "\n>>> did you mean" + preHint + toString(*corrected) + postHint;
if (corrected->getFile())
message += "\n>>> defined in: " + toString(corrected->getFile());
}
info.hasCategoryClassProperties = true;
const InputFile *firstFile;
- for (auto file : files) {
+ for (const InputFile *file : files) {
ImageInfo inputInfo = parseImageInfo(file);
info.hasCategoryClassProperties &= inputInfo.hasCategoryClassProperties;
while (wordsRemaining >= 1 && i < cuIndices.size()) {
idx = cuIndices[i];
const CompactUnwindEntry *cuPtr = &cuEntries[idx];
- if (cuPtr->functionAddress >= functionAddressMax) {
+ if (cuPtr->functionAddress >= functionAddressMax)
break;
- } else if (commonEncodingIndexes.count(cuPtr->encoding) ||
- page.localEncodingIndexes.count(cuPtr->encoding)) {
+ if (commonEncodingIndexes.count(cuPtr->encoding) ||
+ page.localEncodingIndexes.count(cuPtr->encoding)) {
i++;
wordsRemaining--;
} else if (wordsRemaining >= 2 && n < COMPACT_ENCODINGS_MAX) {
if (!osec->isNeeded())
continue;
// Other kinds of OutputSections have already been finalized.
- if (auto concatOsec = dyn_cast<ConcatOutputSection>(osec))
+ if (auto *concatOsec = dyn_cast<ConcatOutputSection>(osec))
concatOsec->finalizeContents();
}
}