Adds a method which, when called with function.getArg(i), returns an
Argument* to the i'th argument.
Patch by Henry Wildermuth
Differential Revision: https://reviews.llvm.org/D64925
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367576
91177308-0d34-0410-b5e6-
96231b3b80d8
return Arguments + NumArgs;
}
+ Argument* getArg(unsigned i) const {
+ assert (i < NumArgs && "getArg() out of range!");
+ CheckLazyArguments();
+ return Arguments + i;
+ }
+
iterator_range<arg_iterator> args() {
return make_range(arg_begin(), arg_end());
}
// The argument list should be populated at first access.
(void)F->arg_begin();
EXPECT_FALSE(F->hasLazyArguments());
+
+ // Checking that getArg gets the arguments from F1 in the correct order.
+ unsigned i = 0;
+ for (Argument &A : F->args()) {
+ EXPECT_EQ(&A, F->getArg(i));
+ ++i;
+ }
+ EXPECT_FALSE(F->hasLazyArguments());
}
TEST(FunctionTest, stealArgumentListFrom) {