[PATCH] D64925: [IR] Add getArg() method to Function class

Henry Wildermuth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 07:56:58 PDT 2019


hmwildermuth created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adds a method which, when called with function.getArg(i), returns an Argument* to the i'th argument.


Repository:
  rL LLVM

https://reviews.llvm.org/D64925

Files:
  llvm/include/llvm/IR/Function.h


Index: llvm/include/llvm/IR/Function.h
===================================================================
--- llvm/include/llvm/IR/Function.h
+++ llvm/include/llvm/IR/Function.h
@@ -710,6 +710,12 @@
     return Arguments + NumArgs;
   }

+  Argument* getArg(unsigned i) const {
+    CheckLazyArguments();
+    assert (i < NumArgs && "getArg() out of range!");
+    return Arguments + i;
+  }
+
   iterator_range<arg_iterator> args() {
     return make_range(arg_begin(), arg_end());
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64925.210568.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190718/0238f53c/attachment.bin>


More information about the llvm-commits mailing list