source: src/ResolvExpr/CurrentObject.h @ e16e27e1

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since e16e27e1 was 2b59f55, checked in by Aaron Moss <a3moss@…>, 5 years ago

More resolver porting

  • Property mode set to 100644
File size: 2.2 KB
Line 
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//
7// CurrentObject.h --
8//
9// Author           : Rob Schluntz
10// Created On       : Thu Jun  8 11:07:25 2017
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Jul 22 09:36:48 2017
13// Update Count     : 3
14//
15
16#pragma once
17
18#include <list>   // for list
19#include <memory> // for unique_ptr
20#include <stack>  // for stack
21#include <vector>
22
23#include "Common/CodeLocation.h"
24
25class Designation;
26class Type;
27struct InitAlternative;
28
29namespace ResolvExpr {
30        class MemberIterator;
31
32        // TODO: memory management of MemberIterators
33        class CurrentObject {
34        public:
35                CurrentObject();
36                CurrentObject( Type * type );
37
38                /// resolves unresolved designation
39                Designation * findNext( Designation * designation );
40                /// sets current position using resolved designation
41                void setNext( Designation * designation );
42                /// steps to next sub-object of current-object
43                void increment();
44                /// sets new current-object for the duration of this brace-enclosed initializer-list
45                void enterListInit();
46                /// restores previous current-object
47                void exitListInit();
48                /// produces a list of alternatives (Type *, Designation *) for the current sub-object's initializer
49                std::list< InitAlternative > getOptions();
50                /// produces the type of the current object but no subobjects
51                Type * getCurrentType();
52
53        private:
54                std::stack< MemberIterator * > objStack;
55        };
56} // namespace ResolvExpr
57
58namespace ast {
59        // AST class types
60        class Designation;
61        class InitAlternative;
62        class Type;
63
64        // forward declaration of internal detail
65        class MemberIterator;
66
67        /// Builds initializer lists in resolution
68        class CurrentObject final {
69                std::vector< std::shared_ptr<MemberIterator> > objStack;
70       
71        public:
72                CurrentObject() = default;
73                CurrentObject( const CodeLocation & loc, const Type * type );
74
75                /// produces a list of alternatives (Type *, Designation *) for the current sub-object's
76                /// initializer.
77                std::vector< InitAlternative > getOptions();
78        };
79} // namespace ast
80
81// Local Variables: //
82// tab-width: 4 //
83// mode: c++ //
84// compile-command: "make install" //
85// End: //
86
Note: See TracBrowser for help on using the repository browser.