diff options
Diffstat (limited to 'include/llvm/IR/Constants.h')
-rw-r--r-- | include/llvm/IR/Constants.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/IR/Constants.h b/include/llvm/IR/Constants.h index 2a5d14d9464..ded18d1c89f 100644 --- a/include/llvm/IR/Constants.h +++ b/include/llvm/IR/Constants.h @@ -24,6 +24,7 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/Optional.h" #include "llvm/IR/Constant.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/OperandTraits.h" @@ -1071,26 +1072,31 @@ public: /// Getelementptr form. Value* is only accepted for convenience; /// all elements must be Constants. /// + /// \param InRangeIndex the inrange index if present or None. /// \param OnlyIfReducedTy see \a getWithOperands() docs. static Constant *getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Constant *> IdxList, bool InBounds = false, + Optional<unsigned> InRangeIndex = None, Type *OnlyIfReducedTy = nullptr) { return getGetElementPtr( Ty, C, makeArrayRef((Value * const *)IdxList.data(), IdxList.size()), - InBounds, OnlyIfReducedTy); + InBounds, InRangeIndex, OnlyIfReducedTy); } static Constant *getGetElementPtr(Type *Ty, Constant *C, Constant *Idx, bool InBounds = false, + Optional<unsigned> InRangeIndex = None, Type *OnlyIfReducedTy = nullptr) { // This form of the function only exists to avoid ambiguous overload // warnings about whether to convert Idx to ArrayRef<Constant *> or // ArrayRef<Value *>. - return getGetElementPtr(Ty, C, cast<Value>(Idx), InBounds, OnlyIfReducedTy); + return getGetElementPtr(Ty, C, cast<Value>(Idx), InBounds, InRangeIndex, + OnlyIfReducedTy); } static Constant *getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Value *> IdxList, bool InBounds = false, + Optional<unsigned> InRangeIndex = None, Type *OnlyIfReducedTy = nullptr); /// Create an "inbounds" getelementptr. See the documentation for the |