[e4d829b] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[c92bdcc] | 7 | // CurrentObject.hpp -- |
---|
[e4d829b] | 8 | // |
---|
| 9 | // Author : Rob Schluntz |
---|
| 10 | // Created On : Thu Jun 8 11:07:25 2017 |
---|
[485393c] | 11 | // Last Modified By : Andrew Beach |
---|
| 12 | // Last Modified On : Thu Apr 6 16:14:00 2023 |
---|
| 13 | // Update Count : 4 |
---|
[e4d829b] | 14 | // |
---|
| 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[e4d829b] | 17 | |
---|
[60aaa51d] | 18 | #include <deque> |
---|
[b7d92b96] | 19 | #include <memory> // for unique_ptr |
---|
| 20 | #include <vector> |
---|
[e4d829b] | 21 | |
---|
[60aaa51d] | 22 | #include "AST/Node.hpp" // for ptr |
---|
[c92bdcc] | 23 | #include "Common/CodeLocation.hpp" |
---|
[2b59f55] | 24 | |
---|
[2908f08] | 25 | namespace ast { |
---|
| 26 | |
---|
| 27 | // AST class types: |
---|
[ea6332d] | 28 | class Designation; |
---|
| 29 | class Type; |
---|
| 30 | struct InitAlternative; |
---|
[e4d829b] | 31 | |
---|
[2908f08] | 32 | /// Iterates members of a type by initializer |
---|
| 33 | class MemberIterator; |
---|
[e4d829b] | 34 | |
---|
[2908f08] | 35 | /// Builds initializer lists in resolution |
---|
| 36 | class CurrentObject final { |
---|
| 37 | std::vector<std::shared_ptr<MemberIterator>> objStack; |
---|
[b7d92b96] | 38 | |
---|
[2908f08] | 39 | public: |
---|
| 40 | CurrentObject() = default; |
---|
| 41 | CurrentObject( const CodeLocation & loc, const Type * type ); |
---|
[b7d92b96] | 42 | |
---|
[2908f08] | 43 | /// Resolves unresolved designation. |
---|
| 44 | const Designation * findNext( const Designation * designation ); |
---|
| 45 | /// Sets current position using the resolved designation. |
---|
| 46 | void setNext( const Designation * designation ); |
---|
| 47 | /// Steps to next sub-object of current object. |
---|
| 48 | void increment(); |
---|
| 49 | /// Sets new current object for the duration of this brace-enclosed intializer-list. |
---|
| 50 | void enterListInit( const CodeLocation & loc ); |
---|
| 51 | /// Restores previous current object. |
---|
| 52 | void exitListInit(); |
---|
| 53 | /// Produces a list of alternatives (Type *, Designation *) |
---|
| 54 | /// for the current sub-object's initializer. |
---|
| 55 | std::deque< InitAlternative > getOptions(); |
---|
| 56 | /// Produces the type of the current object but no subobjects. |
---|
| 57 | const Type * getCurrentType(); |
---|
| 58 | }; |
---|
[2b59f55] | 59 | |
---|
[b7d92b96] | 60 | } // namespace ast |
---|
| 61 | |
---|
[e4d829b] | 62 | // Local Variables: // |
---|
| 63 | // tab-width: 4 // |
---|
| 64 | // mode: c++ // |
---|
| 65 | // compile-command: "make install" // |
---|
| 66 | // End: // |
---|
| 67 | |
---|