source: src/Parser/TypeData.h @ 26ef3b2

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 26ef3b2 was 8f91c9ae, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

add inline qualifier to aggregate fields to separate plan 9 and forward semantics

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