source: src/ResolvExpr/CurrentObject.h @ ab9c1b3

Last change on this file since ab9c1b3 was 2908f08, checked in by Andrew Beach <ajbeach@…>, 12 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
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 : Andrew Beach
12// Last Modified On : Thu Apr  6 16:14:00 2023
13// Update Count     : 4
14//
15
16#pragma once
17
18#include <deque>
19#include <memory> // for unique_ptr
20#include <vector>
21
22#include "AST/Node.hpp"  // for ptr
23#include "Common/CodeLocation.h"
24
25namespace ast {
26
27// AST class types:
28class Designation;
29class Type;
30struct InitAlternative;
31
32/// Iterates members of a type by initializer
33class MemberIterator;
34
35/// Builds initializer lists in resolution
36class CurrentObject final {
37        std::vector<std::shared_ptr<MemberIterator>> objStack;
38
39public:
40        CurrentObject() = default;
41        CurrentObject( const CodeLocation & loc, const Type * type );
42
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};
59
60} // namespace ast
61
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.