diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 1e9a9197aed7..e2354c40844a 100644 --- a/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -596,10 +596,10 @@ static void writeStringRecord(BitstreamWriter &Stream, unsigned Code, SmallVector<unsigned, 64> Vals; // Code: [strchar x N] - for (unsigned i = 0, e = Str.size(); i != e; ++i) { - if (AbbrevToUse && !BitCodeAbbrevOp::isChar6(Str[i])) + for (char C : Str) { + if (AbbrevToUse && !BitCodeAbbrevOp::isChar6(C)) AbbrevToUse = 0; - Vals.push_back(Str[i]); + Vals.push_back(C); } // Emit the finished record. @@ -914,8 +914,7 @@ void ModuleBitcodeWriter::writeTypeTable() { TypeVals.clear(); // Loop over all of the types, emitting each in turn. - for (unsigned i = 0, e = TypeList.size(); i != e; ++i) { - Type *T = TypeList[i]; + for (Type *T : TypeList) { int AbbrevToUse = 0; unsigned Code = 0; @@ -3343,19 +3342,18 @@ void ModuleBitcodeWriter::writeFunction( DILocation *LastDL = nullptr; // Finally, emit all the instructions, in order. - for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); - I != E; ++I) { - writeInstruction(*I, InstID, Vals); + for (const BasicBlock &BB : F) + for (const Instruction &I : BB) { + writeInstruction(I, InstID, Vals); - if (!I->getType()->isVoidTy()) + if (!I.getType()->isVoidTy()) ++InstID; // If the instruction has metadata, write a metadata attachment later. - NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc(); + NeedsMetadataAttachment |= I.hasMetadataOtherThanDebugLoc(); // If the instruction has a debug location, emit it. - DILocation *DL = I->getDebugLoc(); + DILocation *DL = I.getDebugLoc(); if (!DL) continue; @@ -4429,9 +4427,9 @@ void ModuleBitcodeWriter::write() { // Emit function bodies. DenseMap<const Function *, uint64_t> FunctionToBitcodeIndex; - for (Module::const_iterator F = M.begin(), E = M.end(); F != E; ++F) - if (!F->isDeclaration()) - writeFunction(*F, FunctionToBitcodeIndex); + for (const Function &F : M) + if (!F.isDeclaration()) + writeFunction(F, FunctionToBitcodeIndex); // Need to write after the above call to WriteFunction which populates // the summary information in the index. |