source: src/Parser/TypeData.h @ 7069652

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

move type FuncSpecifiers? from DeclarationNode? to Type

  • Property mode set to 100644
File size: 3.7 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 Mar 16 08:32:39 2017
13// Update Count     : 185
14//
15
16#ifndef TYPEDATA_H
17#define TYPEDATA_H
18
19#include "ParseNode.h"
20#include "SynTree/Type.h"
21
22struct TypeData {
23        enum Kind { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
24                                SymbolicInst, Tuple, Typeof, Builtin, Unknown };
25
26        struct Aggregate_t {
27                DeclarationNode::Aggregate kind;
28                const std::string * name;
29                DeclarationNode * params;
30                ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
31                DeclarationNode * fields;
32                bool body;
33        };
34
35        struct AggInst_t {
36                TypeData * aggregate;
37                ExpressionNode * params;
38                bool hoistType;
39        };
40
41        struct Array_t {
42                ExpressionNode * dimension;
43                bool isVarLen;
44                bool isStatic;
45        };
46
47        struct Enumeration_t {
48                const std::string * name;
49                DeclarationNode * constants;
50                bool body;
51        };
52
53        struct Function_t {
54                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
55                mutable DeclarationNode * idList;                               // old-style
56                mutable DeclarationNode * oldDeclList;
57                StatementNode * body;
58                bool newStyle;
59        };
60
61        struct Symbolic_t {
62                const std::string * name;
63                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
64                DeclarationNode * params;
65                ExpressionNode * actuals;
66                DeclarationNode * assertions;
67        };
68
69        Kind kind;
70        TypeData * base;
71        DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
72        DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
73        DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
74        DeclarationNode::Length length = DeclarationNode::NoLength;
75        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
76
77        Type::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
91        TypeData( Kind k = Unknown );
92        ~TypeData();
93        void print( std::ostream &, int indent = 0 ) const;
94        TypeData * clone() const;
95};
96
97Type * typebuild( const TypeData * );
98TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
99Type::Qualifiers buildQualifiers( const TypeData * td );
100Type * buildBasicType( const TypeData * );
101PointerType * buildPointer( const TypeData * );
102ArrayType * buildArray( const TypeData * );
103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
105ReferenceToType * buildAggInst( const TypeData * );
106TypeDecl * buildVariable( const TypeData * );
107EnumDecl * buildEnum( const TypeData *, std::list< Attribute * > );
108TypeInstType * buildSymbolicInst( const TypeData * );
109TupleType * buildTuple( const TypeData * );
110TypeofType * buildTypeof( const TypeData * );
111Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
112FunctionType * buildFunction( const TypeData * );
113void buildKRFunction( const TypeData::Function_t & function );
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.