source: src/Parser/TypeData.h @ ca1a547

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

fixed missing body in enumeration, removed hashBody function flag, only generate sue prototype if body

  • Property mode set to 100644
File size: 3.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// 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 : Thu Feb 23 15:16:18 2017
13// Update Count     : 155
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                bool body;
52        };
53
54        struct Function_t {
55                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
56                mutable DeclarationNode * idList;                               // old-style
57                mutable DeclarationNode * oldDeclList;
58                StatementNode * body;
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        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
77        typedef std::bitset< DeclarationNode::NoQualifier > Qualifiers;
78        Qualifiers qualifiers;
79        DeclarationNode * forall;
80
81                // Basic_t basic;
82                Aggregate_t aggregate;
83                AggInst_t aggInst;
84                Array_t array;
85                Enumeration_t enumeration;
86                // Variable_t variable;
87                Function_t function;
88                Symbolic_t symbolic;
89                DeclarationNode * tuple;
90                ExpressionNode * typeexpr;
91                // DeclarationNode::BuiltinType builtin;
92
93        TypeData( Kind k = Unknown );
94        ~TypeData();
95        void print( std::ostream &, int indent = 0 ) const;
96        TypeData * clone() const;
97};
98
99Type * typebuild( const TypeData * );
100TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
101Type::Qualifiers buildQualifiers( const TypeData * td );
102Type * buildBasicType( const TypeData * );
103PointerType * buildPointer( const TypeData * );
104ArrayType * buildArray( const TypeData * );
105AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
106ReferenceToType * buildAggInst( const TypeData * );
107NamedTypeDecl * buildSymbolic( const TypeData *, const std::string &name, DeclarationNode::StorageClass sc );
108TypeDecl * buildVariable( const TypeData * );
109EnumDecl * buildEnum( const TypeData *, std::list< Attribute * > );
110TypeInstType * buildSymbolicInst( const TypeData * );
111TupleType * buildTuple( const TypeData * );
112TypeofType * buildTypeof( const TypeData * );
113Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
114FunctionType * buildFunction( const TypeData * );
115void buildKRFunction( const TypeData::Function_t & function );
116
117#endif // TYPEDATA_H
118
119// Local Variables: //
120// tab-width: 4 //
121// mode: c++ //
122// compile-command: "make install" //
123// End: //
Note: See TracBrowser for help on using the repository browser.