source: src/Parser/TypeData.h @ bf32bb8

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 bf32bb8 was faddbd8, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

more refactoring of parser code, new tuple syntax

  • 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 Oct  3 12:34:08 2016
13// Update Count     : 142
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 { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
26                                SymbolicInst, Tuple, Typeof, Builtin, Unknown };
27
28        struct Aggregate_t {
29                DeclarationNode::Aggregate kind;
30                const std::string * name;
31                DeclarationNode * params;
32                ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
33                DeclarationNode * fields;
34                bool body;
35        };
36
37        struct AggInst_t {
38                TypeData * aggregate;
39                ExpressionNode * params;
40        };
41
42        struct Array_t {
43                ExpressionNode * dimension;
44                bool isVarLen;
45                bool isStatic;
46        };
47
48        struct Enumeration_t {
49                const std::string * name;
50                DeclarationNode * constants;
51        };
52
53        struct Function_t {
54                DeclarationNode * params;
55                DeclarationNode * idList;                                               // old-style
56                DeclarationNode * oldDeclList;
57                StatementNode * body;
58                bool hasBody;
59                bool newStyle;
60        };
61
62        struct Symbolic_t {
63                const std::string * name;
64                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
65                DeclarationNode * params;
66                ExpressionNode * actuals;
67                DeclarationNode * assertions;
68        };
69
70        Kind kind;
71        TypeData * base;
72        DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
73        DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
74        DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
75        DeclarationNode::Length length = DeclarationNode::NoLength;
76        typedef std::bitset< DeclarationNode::NoQualifier > Qualifiers;
77        Qualifiers qualifiers;
78        DeclarationNode * forall;
79
80                // Basic_t basic;
81                Aggregate_t aggregate;
82                AggInst_t aggInst;
83                Array_t array;
84                Enumeration_t enumeration;
85                // Variable_t variable;
86                Function_t function;
87                Symbolic_t symbolic;
88                DeclarationNode * tuple;
89                ExpressionNode * typeexpr;
90                // DeclarationNode::BuiltinType builtin;
91
92        TypeData( Kind k = Unknown );
93        ~TypeData();
94        void print( std::ostream &, int indent = 0 ) const;
95        TypeData * clone() const;
96};
97
98Type * typebuild( const TypeData * );
99TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
100Type::Qualifiers buildQualifiers( const TypeData * td );
101Type * buildBasicType( const TypeData * );
102PointerType * buildPointer( const TypeData * );
103ArrayType * buildArray( const TypeData * );
104AggregateDecl * buildAggregate( const TypeData * );
105ReferenceToType * buildAggInst( const TypeData * );
106NamedTypeDecl * buildSymbolic( const TypeData *, const std::string &name, DeclarationNode::StorageClass sc );
107TypeDecl * buildVariable( const TypeData * );
108EnumDecl * buildEnum( const TypeData * );
109TypeInstType * buildSymbolicInst( const TypeData * );
110TupleType * buildTuple( const TypeData * );
111TypeofType * buildTypeof( const TypeData * );
112Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, Initializer * init = nullptr );
113FunctionType * buildFunction( const TypeData * );
114
115#endif // TYPEDATA_H
116
117// Local Variables: //
118// tab-width: 4 //
119// mode: c++ //
120// compile-command: "make install" //
121// End: //
Note: See TracBrowser for help on using the repository browser.