source: src/Parser/TypeData.h @ 8d25360

no_list
Last change on this file since 8d25360 was 8d25360, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Fixed problems with changing some lists to vectors

  • Property mode set to 100644
File size: 4.4 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 Nov  1 20:56:46 2018
13// Update Count     : 196
14//
15
16#pragma once
17
18#include <iosfwd>                // for ostream
19#include <list>                  // for list
20#include <string>                // for string
21#include <vector>
22
23#include "ParseNode.h"           // for DeclarationNode, DeclarationNode::Ag...
24#include "Parser/LinkageSpec.h"  // for Spec
25#include "SynTree/Type.h"        // for Type, ReferenceToType (ptr only)
26#include "SynTree/SynTree.h"     // for Visitor Nodes
27
28struct TypeData {
29        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
30                                SymbolicInst, Tuple, Typeof, Basetypeof, Builtin, GlobalScope, Qualified, Unknown };
31
32        struct Aggregate_t {
33                DeclarationNode::Aggregate kind;
34                const std::string * name;
35                DeclarationNode * params;
36                ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
37                DeclarationNode * fields;
38                bool body;
39                bool anon;
40
41                bool tagged;
42                const std::string * parent;
43        };
44
45        struct AggInst_t {
46                TypeData * aggregate;
47                ExpressionNode * params;
48                bool hoistType;
49        };
50
51        struct Array_t {
52                ExpressionNode * dimension;
53                bool isVarLen;
54                bool isStatic;
55        };
56
57        struct Enumeration_t {
58                const std::string * name;
59                DeclarationNode * constants;
60                bool body;
61                bool anon;
62        };
63
64        struct Function_t {
65                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
66                mutable DeclarationNode * idList;                               // old-style
67                mutable DeclarationNode * oldDeclList;
68                StatementNode * body;
69                ExpressionNode * withExprs;                                             // expressions from function's with_clause
70        };
71
72        struct Symbolic_t {
73                const std::string * name;
74                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
75                DeclarationNode * params;
76                ExpressionNode * actuals;
77                DeclarationNode * assertions;
78        };
79
80        struct Qualified_t {                                                            // qualified type S.T
81                TypeData * parent;
82                TypeData * child;
83        };
84
85        CodeLocation location;
86
87        Kind kind;
88        TypeData * base;
89        DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
90        DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
91        DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
92        DeclarationNode::Length length = DeclarationNode::NoLength;
93        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
94
95        Type::Qualifiers qualifiers;
96        DeclarationNode * forall;
97
98        Aggregate_t aggregate;
99        AggInst_t aggInst;
100        Array_t array;
101        Enumeration_t enumeration;
102        Function_t function;
103        Symbolic_t symbolic;
104        Qualified_t qualified;
105        DeclarationNode * tuple;
106        ExpressionNode * typeexpr;
107
108        TypeData( Kind k = Unknown );
109        ~TypeData();
110        void print( std::ostream &, int indent = 0 ) const;
111        TypeData * clone() const;
112
113        const std::string * leafName() const;
114};
115
116Type * typebuild( const TypeData * );
117TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
118Type::Qualifiers buildQualifiers( const TypeData * td );
119Type * buildBasicType( const TypeData * );
120PointerType * buildPointer( const TypeData * );
121ArrayType * buildArray( const TypeData * );
122ReferenceType * buildReference( const TypeData * );
123AggregateDecl * buildAggregate( const TypeData *, std::vector< Attribute * > );
124ReferenceToType * buildComAggInst( const TypeData *, std::vector< Attribute * > attributes, LinkageSpec::Spec linkage );
125ReferenceToType * buildAggInst( const TypeData * );
126TypeDecl * buildVariable( const TypeData * );
127EnumDecl * buildEnum( const TypeData *, std::vector< Attribute * >, LinkageSpec::Spec );
128TypeInstType * buildSymbolicInst( const TypeData * );
129TupleType * buildTuple( const TypeData * );
130TypeofType * buildTypeof( const TypeData * );
131Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName,
132                                                 Initializer * init = nullptr, const std::vector< Attribute * > & attributes = std::vector< Attribute * >() );
133FunctionType * buildFunction( const TypeData * );
134void buildKRFunction( const TypeData::Function_t & function );
135
136// Local Variables: //
137// tab-width: 4 //
138// mode: c++ //
139// compile-command: "make install" //
140// End: //
Note: See TracBrowser for help on using the repository browser.