Iterate over StringMaps using structured bindings. NFCI.
This commit is contained in:
parent
02c75e8465
commit
fcf4e360ba
|
@ -815,10 +815,8 @@ bool GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) {
|
|||
IdentifierIndexWriterTrait Trait;
|
||||
|
||||
// Populate the hash table.
|
||||
for (InterestingIdentifierMap::iterator I = InterestingIdentifiers.begin(),
|
||||
IEnd = InterestingIdentifiers.end();
|
||||
I != IEnd; ++I) {
|
||||
Generator.insert(I->first(), I->second, Trait);
|
||||
for (auto &[Identifier, IDs] : InterestingIdentifiers) {
|
||||
Generator.insert(Identifier, IDs, Trait);
|
||||
}
|
||||
|
||||
// Create the on-disk hash table in a buffer.
|
||||
|
|
|
@ -405,8 +405,8 @@ public:
|
|||
/// Sort call targets in descending order of call frequency.
|
||||
static const SortedCallTargetSet SortCallTargets(const CallTargetMap &Targets) {
|
||||
SortedCallTargetSet SortedTargets;
|
||||
for (const auto &I : Targets) {
|
||||
SortedTargets.emplace(I.first(), I.second);
|
||||
for (const auto &[Target, Frequency] : Targets) {
|
||||
SortedTargets.emplace(Target, Frequency);
|
||||
}
|
||||
return SortedTargets;
|
||||
}
|
||||
|
@ -415,8 +415,8 @@ public:
|
|||
static const CallTargetMap adjustCallTargets(const CallTargetMap &Targets,
|
||||
float DistributionFactor) {
|
||||
CallTargetMap AdjustedTargets;
|
||||
for (const auto &I : Targets) {
|
||||
AdjustedTargets[I.first()] = I.second * DistributionFactor;
|
||||
for (const auto &[Target, Frequency] : Targets) {
|
||||
AdjustedTargets[Target] = Frequency * DistributionFactor;
|
||||
}
|
||||
return AdjustedTargets;
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@ private:
|
|||
addProfiledFunction(Samples.getFuncName());
|
||||
|
||||
for (const auto &Sample : Samples.getBodySamples()) {
|
||||
for (const auto &Target : Sample.second.getCallTargets()) {
|
||||
addProfiledFunction(Target.first());
|
||||
addProfiledCall(Samples.getFuncName(), Target.first(), Target.second);
|
||||
for (const auto &[Target, Frequency] : Sample.second.getCallTargets()) {
|
||||
addProfiledFunction(Target);
|
||||
addProfiledCall(Samples.getFuncName(), Target, Frequency);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -592,8 +592,8 @@ std::string codegen::getFeaturesStr() {
|
|||
if (getMCPU() == "native") {
|
||||
StringMap<bool> HostFeatures;
|
||||
if (sys::getHostCPUFeatures(HostFeatures))
|
||||
for (auto &F : HostFeatures)
|
||||
Features.AddFeature(F.first(), F.second);
|
||||
for (const auto &[Feature, IsEnabled] : HostFeatures)
|
||||
Features.AddFeature(Feature, IsEnabled);
|
||||
}
|
||||
|
||||
for (auto const &MAttr : getMAttrs())
|
||||
|
@ -612,8 +612,8 @@ std::vector<std::string> codegen::getFeatureList() {
|
|||
if (getMCPU() == "native") {
|
||||
StringMap<bool> HostFeatures;
|
||||
if (sys::getHostCPUFeatures(HostFeatures))
|
||||
for (auto &F : HostFeatures)
|
||||
Features.AddFeature(F.first(), F.second);
|
||||
for (const auto &[Feature, IsEnabled] : HostFeatures)
|
||||
Features.AddFeature(Feature, IsEnabled);
|
||||
}
|
||||
|
||||
for (auto const &MAttr : getMAttrs())
|
||||
|
|
|
@ -1059,8 +1059,8 @@ int SlotTracker::processIndex() {
|
|||
// assigned consecutively. Since the StringMap iteration order isn't
|
||||
// guaranteed, use a std::map to order by module ID before assigning slots.
|
||||
std::map<uint64_t, StringRef> ModuleIdToPathMap;
|
||||
for (auto &ModPath : TheIndex->modulePaths())
|
||||
ModuleIdToPathMap[ModPath.second.first] = ModPath.first();
|
||||
for (auto &[ModPath, ModId] : TheIndex->modulePaths())
|
||||
ModuleIdToPathMap[ModId.first] = ModPath;
|
||||
for (auto &ModPair : ModuleIdToPathMap)
|
||||
CreateModulePathSlot(ModPair.second);
|
||||
|
||||
|
@ -2875,13 +2875,12 @@ void AssemblyWriter::printModuleSummaryIndex() {
|
|||
std::string RegularLTOModuleName =
|
||||
ModuleSummaryIndex::getRegularLTOModuleName();
|
||||
moduleVec.resize(TheIndex->modulePaths().size());
|
||||
for (auto &ModPath : TheIndex->modulePaths())
|
||||
moduleVec[Machine.getModulePathSlot(ModPath.first())] = std::make_pair(
|
||||
for (auto &[ModPath, ModId] : TheIndex->modulePaths())
|
||||
moduleVec[Machine.getModulePathSlot(ModPath)] = std::make_pair(
|
||||
// A module id of -1 is a special entry for a regular LTO module created
|
||||
// during the thin link.
|
||||
ModPath.second.first == -1u ? RegularLTOModuleName
|
||||
: (std::string)std::string(ModPath.first()),
|
||||
ModPath.second.second);
|
||||
ModId.first == -1u ? RegularLTOModuleName : std::string(ModPath),
|
||||
ModId.second);
|
||||
|
||||
unsigned i = 0;
|
||||
for (auto &ModPair : moduleVec) {
|
||||
|
|
|
@ -258,8 +258,8 @@ char *LLVMGetHostCPUFeatures(void) {
|
|||
StringMap<bool> HostFeatures;
|
||||
|
||||
if (sys::getHostCPUFeatures(HostFeatures))
|
||||
for (auto &F : HostFeatures)
|
||||
Features.AddFeature(F.first(), F.second);
|
||||
for (const auto &[Feature, IsEnabled] : HostFeatures)
|
||||
Features.AddFeature(Feature, IsEnabled);
|
||||
|
||||
return strdup(Features.getString().c_str());
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ LogicalResult PatternApplicatorExtension::findAllMatches(
|
|||
// also used by the following operations.
|
||||
auto *dialect =
|
||||
root->getContext()->getLoadedDialect<transform::TransformDialect>();
|
||||
for (const auto &pair : dialect->getPDLConstraintHooks())
|
||||
patternModule.registerConstraintFunction(pair.first(), pair.second);
|
||||
for (const auto &[name, constraintFn] : dialect->getPDLConstraintHooks())
|
||||
patternModule.registerConstraintFunction(name, constraintFn);
|
||||
|
||||
// Register a noop rewriter because PDL requires patterns to end with some
|
||||
// rewrite call.
|
||||
|
|
|
@ -145,8 +145,8 @@ bool ExecutionEngine::setupTargetTriple(Module *llvmModule) {
|
|||
llvm::StringMap<bool> hostFeatures;
|
||||
|
||||
if (llvm::sys::getHostCPUFeatures(hostFeatures))
|
||||
for (auto &f : hostFeatures)
|
||||
features.AddFeature(f.first(), f.second);
|
||||
for (const auto &[feature, isEnabled] : hostFeatures)
|
||||
features.AddFeature(feature, isEnabled);
|
||||
|
||||
std::unique_ptr<llvm::TargetMachine> machine(target->createTargetMachine(
|
||||
targetTriple, cpu, features.getString(), {}, {}));
|
||||
|
|
Loading…
Reference in New Issue