From bb8cc2f850585968e5f2a5d544f904ca6647b043 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 26 Jun 2015 22:21:52 +0000 Subject: [PATCH] Minor style cleanup after 240843 [NFC] Use a for-each loop in one case and rename the function to reflect it's new usage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240847 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Verifier.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 654a7888f26..82cf811910d 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -370,7 +370,7 @@ private: void visitSelectInst(SelectInst &SI); void visitUserOp1(Instruction &I); void visitUserOp2(Instruction &I) { visitUserOp1(I); } - void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallSite CS); + void visitIntrinsicCallSite(Intrinsic::ID ID, CallSite CS); template void visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII); void visitAtomicCmpXchgInst(AtomicCmpXchgInst &CXI); @@ -2294,7 +2294,7 @@ void Verifier::VerifyCallSite(CallSite CS) { if (Function *F = CS.getCalledFunction()) if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) - visitIntrinsicFunctionCall(ID, CS); + visitIntrinsicCallSite(ID, CS); visitInstruction(*I); } @@ -3140,9 +3140,8 @@ Verifier::VerifyIntrinsicIsVarArg(bool isVarArg, return true; } -/// visitIntrinsicFunction - Allow intrinsics to be verified in different ways. -/// -void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallSite CS) { +/// Allow intrinsics to be verified in different ways. +void Verifier::visitIntrinsicCallSite(Intrinsic::ID ID, CallSite CS) { Function *IF = CS.getCalledFunction(); Assert(IF->isDeclaration(), "Intrinsic functions should never be defined!", IF); @@ -3187,9 +3186,9 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallSite CS) { // If the intrinsic takes MDNode arguments, verify that they are either global // or are local to *this* function. - for (unsigned i = 0, e = CS.getNumArgOperands(); i != e; ++i) - if (auto *MD = dyn_cast(CS.getArgOperand(i))) - visitMetadataAsValue(*MD, CS.getParent()->getParent()); + for (Value *V : CS.args()) + if (auto *MD = dyn_cast(V)) + visitMetadataAsValue(*MD, CS.getCaller()); switch (ID) { default: