From 3ad5c96268db965191ec71cdcb6d8884f6fca99c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 10 Mar 2014 15:03:06 +0000 Subject: [C++11] Modernize the IR library a bit. No functionality change. llvm-svn: 203465 --- llvm/lib/IR/Module.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'llvm/lib/IR/Module.cpp') diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 6a3a38f60b9..c8c07f27a00 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -271,8 +271,7 @@ getModuleFlagsMetadata(SmallVectorImpl &Flags) const { const NamedMDNode *ModFlags = getModuleFlagsMetadata(); if (!ModFlags) return; - for (unsigned i = 0, e = ModFlags->getNumOperands(); i != e; ++i) { - MDNode *Flag = ModFlags->getOperand(i); + for (const MDNode *Flag : ModFlags->operands()) { if (Flag->getNumOperands() >= 3 && isa(Flag->getOperand(0)) && isa(Flag->getOperand(1))) { // Check the operands of the MDNode before accessing the operands. @@ -291,8 +290,7 @@ getModuleFlagsMetadata(SmallVectorImpl &Flags) const { Value *Module::getModuleFlag(StringRef Key) const { SmallVector ModuleFlags; getModuleFlagsMetadata(ModuleFlags); - for (unsigned I = 0, E = ModuleFlags.size(); I < E; ++I) { - const ModuleFlagEntry &MFE = ModuleFlags[I]; + for (const ModuleFlagEntry &MFE : ModuleFlags) { if (Key == MFE.Key->getString()) return MFE.Val; } -- cgit v1.2.3