1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

[IR] Use range-based for loops (NFC)

This commit is contained in:
Kazu Hirata 2021-03-01 23:40:32 -08:00
parent e503e87089
commit 99066de18c
4 changed files with 10 additions and 14 deletions

View File

@ -4373,9 +4373,8 @@ void AssemblyWriter::writeMDNode(unsigned Slot, const MDNode *Node) {
void AssemblyWriter::writeAllMDNodes() {
SmallVector<const MDNode *, 16> Nodes;
Nodes.resize(Machine.mdn_size());
for (SlotTracker::mdn_iterator I = Machine.mdn_begin(), E = Machine.mdn_end();
I != E; ++I)
Nodes[I->second] = cast<MDNode>(I->first);
for (auto &I : llvm::make_range(Machine.mdn_begin(), Machine.mdn_end()))
Nodes[I.second] = cast<MDNode>(I.first);
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
writeMDNode(i, Nodes[i]);

View File

@ -3280,9 +3280,8 @@ unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
for (CatchSwitchInst::handler_iterator I = CSI->handler_begin(),
E = CSI->handler_end(); I != E; ++I)
*Handlers++ = wrap(*I);
for (const BasicBlock *H : CSI->handlers())
*Handlers++ = wrap(H);
}
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad) {

View File

@ -292,10 +292,9 @@ void ModuleSummaryIndex::propagateAttributes(
if (!IsDSOLocal)
// Mark the flag in all summaries false so that we can do quick check
// without going through the whole list.
llvm::for_each(P.second.SummaryList,
[](const std::unique_ptr<GlobalValueSummary> &Summary) {
return Summary->setDSOLocal(false);
});
for (const std::unique_ptr<GlobalValueSummary> &Summary :
P.second.SummaryList)
Summary->setDSOLocal(false);
}
setWithAttributePropagation();
setWithDSOLocalPropagation();

View File

@ -3671,10 +3671,9 @@ void Verifier::visitStoreInst(StoreInst &SI) {
/// Check that SwiftErrorVal is used as a swifterror argument in CS.
void Verifier::verifySwiftErrorCall(CallBase &Call,
const Value *SwiftErrorVal) {
unsigned Idx = 0;
for (auto I = Call.arg_begin(), E = Call.arg_end(); I != E; ++I, ++Idx) {
if (*I == SwiftErrorVal) {
Assert(Call.paramHasAttr(Idx, Attribute::SwiftError),
for (const auto &I : llvm::enumerate(Call.args())) {
if (I.value() == SwiftErrorVal) {
Assert(Call.paramHasAttr(I.index(), Attribute::SwiftError),
"swifterror value when used in a callsite should be marked "
"with swifterror attribute",
SwiftErrorVal, Call);