diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-26 23:21:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-26 23:21:34 +0000 |
commit | b0fef64dc98d32b90782360aa9480417b7ca34fd (patch) | |
tree | ea9d0d546c9eadef891aa47fcdb9b6db896672dc /utils/TableGen/Record.cpp | |
parent | a60ff2e14485aa3baec2088f5663d3e25cb74992 (diff) |
Add initial support for list slices. This currently allows you to do stuff
like this:
def B {
list<int> X = [10, 20, 30, 4, 1, 1231, 20] [2-4,2,2,0-6];
}
... which isn't particularly useful, but more is to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r-- | utils/TableGen/Record.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 3fc14c59ed..fee36b023a 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -310,6 +310,16 @@ Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) { return BI; } +Init *ListInit::convertInitListSlice(const std::vector<unsigned> &Elements) { + std::vector<Init*> Vals; + for (unsigned i = 0, e = Elements.size(); i != e; ++i) { + if (Elements[i] >= getSize()) + return 0; + Vals.push_back(getElement(Elements[i])); + } + return new ListInit(Vals); +} + void ListInit::print(std::ostream &OS) const { OS << "["; for (unsigned i = 0, e = Values.size(); i != e; ++i) { |