Add CallSite::hasArgument to allow for seeing if a call passes a certain value as...
authorMatthijs Kooijman <matthijs@stdin.nl>
Wed, 4 Jun 2008 16:31:12 +0000 (16:31 +0000)
committerMatthijs Kooijman <matthijs@stdin.nl>
Wed, 4 Jun 2008 16:31:12 +0000 (16:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51946 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/CallSite.h
lib/VMCore/Instructions.cpp

index f118680d6fc8304befd4a7c753c4770cf88aa9fe..513269fb5f84d5bdc3766a0c1c70ce608ca808cd 100644 (file)
@@ -129,6 +129,10 @@ public:
     else
       I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB
   }
+  
+  /// hasArgument - Returns true if this CallSite passes the given Value* as an
+  /// argument to the called function.
+  bool hasArgument(Value *Arg);
 
   /// arg_iterator - The type of iterator to use when looping over actual
   /// arguments at this call site...
index 3fb1c61b7227dace46674bce95542c5e6759417d..d78926742cf3e0d2fd81f53c85b4d0b2753badd8 100644 (file)
@@ -91,6 +91,13 @@ void CallSite::setDoesNotThrow(bool doesNotThrow) {
     cast<InvokeInst>(I)->setDoesNotThrow(doesNotThrow);
 }
 
+bool CallSite::hasArgument(Value *Arg) {
+  for (arg_iterator AI = this->arg_begin(), E = this->arg_end(); AI != E; ++AI)
+    if (AI->get() == Arg)
+      return true;
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 //                            TerminatorInst Class
 //===----------------------------------------------------------------------===//