[llvm-commits] PATCH: Additional convenience methods for ConstantStruct, ConstantArray, and ConstantVector.

Chris Lattner clattner at apple.com
Thu Feb 17 15:55:08 PST 2011


On Feb 10, 2011, at 1:40 PM, Talin wrote:

> This patch adds a new "get" method to ConstantStruct, ConstantArray and ConstantVector. The new method accepts a pair of RandomAccessIterators, similar to other LLVM method signatures. This allows constants to be build using a small vector or other sequential container type more easily.

Hi Talin,

I don't think that this is the right way to go.  Generic random access iterators are not guaranteed to be contiguous in memory (e.g. std::deque).

Doesn't ArrayRef solve this need?

> In addition, I've also added an END_WITH_NULL variant for ConstantStruct::get(). I only added it to ConstantStruct because I figured that it would be an uncommon use case for arrays and vectors, whereas the creation of small constant structs of predetermined length is fairly common.

This part seems fine to me,

-Chris



More information about the llvm-commits mailing list