[C++11] More 'nullptr' conversion or in some cases just using a boolean check instead...
[oota-llvm.git] / include / llvm / IR / CallSite.h
index 8c64099d577c54347931922737ed23c5b3b40111..bdac61a89bb8bc9118e5341bd66718e198cd37b6 100644 (file)
@@ -47,7 +47,7 @@ class CallSiteBase {
 protected:
   PointerIntPair<InstrTy*, 1, bool> I;
 public:
-  CallSiteBase() : I(0, false) {}
+  CallSiteBase() : I(nullptr, false) {}
   CallSiteBase(CallTy *CI) : I(CI, true) { assert(CI); }
   CallSiteBase(InvokeTy *II) : I(II, false) { assert(II); }
   CallSiteBase(ValTy *II) { *this = get(II); }
@@ -103,11 +103,13 @@ public:
 
   /// isCallee - Determine whether the passed iterator points to the
   /// callee operand's Use.
-  ///
-  bool isCallee(value_use_iterator<UserTy> UI) const {
-    return getCallee() == &UI.getUse();
+  bool isCallee(Value::const_user_iterator UI) const {
+    return isCallee(&UI.getUse());
   }
 
+  /// Determine whether this Use is the callee operand's Use.
+  bool isCallee(const Use *U) const { return getCallee() == U; }
+
   ValTy *getArgument(unsigned ArgNo) const {
     assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
     return *(arg_begin() + ArgNo);
@@ -121,11 +123,17 @@ public:
 
   /// Given a value use iterator, returns the argument that corresponds to it.
   /// Iterator must actually correspond to an argument.
-  unsigned getArgumentNo(value_use_iterator<UserTy> I) const {
+  unsigned getArgumentNo(Value::const_user_iterator I) const {
+    return getArgumentNo(&I.getUse());
+  }
+
+  /// Given a use for an argument, get the argument number that corresponds to
+  /// it.
+  unsigned getArgumentNo(const Use *U) const {
     assert(getInstruction() && "Not a call or invoke instruction!");
-    assert(arg_begin() <= &I.getUse() && &I.getUse() < arg_end()
+    assert(arg_begin() <= U && U < arg_end()
            && "Argument # out of range!");
-    return &I.getUse() - arg_begin();
+    return U - arg_begin();
   }
 
   /// arg_iterator - The type of iterator to use when looping over actual