source: src/Parser/TypeData.h @ d1969a6

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since d1969a6 was 28307be, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

more refactoring of parser code

  • Property mode set to 100644
File size: 3.5 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// TypeData.h --
8//
9// Author           : Rodolfo G. Esteves
10// Created On       : Sat May 16 15:18:36 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Mon Aug 29 22:31:52 2016
13// Update Count     : 110
14//
15
16#ifndef TYPEDATA_H
17#define TYPEDATA_H
18
19#include <bitset>
20
21#include "ParseNode.h"
22#include "SynTree/Type.h"
23
24struct TypeData {
25        enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
26                                Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Builtin, Attr };
27
28        struct Basic_t {
29                std::list< DeclarationNode::BasicType > typeSpec;
30                std::list< DeclarationNode::Modifier > modifiers;
31        };
32
33        struct Aggregate_t {
34                DeclarationNode::Aggregate kind;
35                std::string name;
36                DeclarationNode * params;
37                ExpressionNode  * actuals;                                              // holds actual parameters later applied to AggInst
38                DeclarationNode * fields;
39                bool body;
40        };
41
42        struct AggInst_t {
43                TypeData * aggregate;
44                ExpressionNode * params;
45        };
46
47        struct Array_t {
48                ExpressionNode * dimension;
49                bool isVarLen;
50                bool isStatic;
51        };
52
53        struct Enumeration_t {
54                std::string name;
55                DeclarationNode * constants;
56        };
57
58        struct Function_t {
59                DeclarationNode * params;
60                DeclarationNode * idList;                                               // old-style
61                DeclarationNode * oldDeclList;
62                StatementNode * body;
63                bool hasBody;
64                bool newStyle;
65        };
66
67        struct Symbolic_t {
68                std::string name;
69                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
70                DeclarationNode * params;
71                ExpressionNode * actuals;
72                DeclarationNode * assertions;
73        };
74
75        // struct Tuple_t {
76        //      DeclarationNode * members;
77        // };
78 
79        // struct Typeof_t {
80        //      ExpressionNode * expr;
81        // };
82
83        // struct Builtin_t {
84        //      DeclarationNode::BuiltinType type;
85        // };
86
87        Kind kind;
88        TypeData * base;
89        typedef std::bitset< DeclarationNode::NoOfQualifier > Qualifiers;
90        Qualifiers qualifiers;
91        DeclarationNode * forall;
92
93                Basic_t basic;
94                Aggregate_t aggregate;
95                AggInst_t aggInst;
96                Array_t array;
97                Enumeration_t enumeration;
98                Function_t function;
99                Symbolic_t symbolic;
100                DeclarationNode * tuple;
101                ExpressionNode * typeexpr;
102                //Attr_t attr;
103                // DeclarationNode::BuiltinType builtin;
104
105        TypeData( Kind k = Unknown );
106        ~TypeData();
107        void print( std::ostream &, int indent = 0 ) const;
108        TypeData * clone() const;
109};
110
111Type * typebuild( const TypeData * );
112TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
113Type::Qualifiers buildQualifiers( const TypeData * td );
114Type * buildBasicType( const TypeData * );
115PointerType * buildPointer( const TypeData * );
116ArrayType * buildArray( const TypeData * );
117AggregateDecl * buildAggregate( const TypeData * );
118ReferenceToType * buildAggInst( const TypeData * );
119NamedTypeDecl * buildSymbolic( const TypeData *, const std::string &name, DeclarationNode::StorageClass sc );
120TypeDecl * buildVariable( const TypeData * );
121EnumDecl * buildEnum( const TypeData * );
122TypeInstType * buildSymbolicInst( const TypeData * );
123TupleType * buildTuple( const TypeData * );
124TypeofType * buildTypeof( const TypeData * );
125AttrType * buildAttr( const TypeData * );
126Declaration * buildDecl( const TypeData *, std::string, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, Initializer * init = 0 );
127FunctionType * buildFunction( const TypeData * );
128
129#endif // TYPEDATA_H
130
131// Local Variables: //
132// tab-width: 4 //
133// mode: c++ //
134// compile-command: "make install" //
135// End: //
Note: See TracBrowser for help on using the repository browser.