source: src/ResolvExpr/CurrentObject.h

Last change on this file was 2908f08, checked in by Andrew Beach <ajbeach@…>, 5 months ago

Most of ResolvExpr? was written before the new style standard. Some files updated, focus on headers.

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[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//
7// CurrentObject.h --
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
[2b59f55]23#include "Common/CodeLocation.h"
24
[2908f08]25namespace ast {
26
27// AST class types:
[ea6332d]28class Designation;
29class Type;
30struct InitAlternative;
[e4d829b]31
[2908f08]32/// Iterates members of a type by initializer
33class MemberIterator;
[e4d829b]34
[2908f08]35/// Builds initializer lists in resolution
36class CurrentObject final {
37        std::vector<std::shared_ptr<MemberIterator>> objStack;
[b7d92b96]38
[2908f08]39public:
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
Note: See TracBrowser for help on using the repository browser.