source: src/Parser/TypeData.h @ 553772b

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 553772b was 5509ff4, checked in by tdelisle <tdelisle@…>, 5 years ago

Added proper initialization to TypeData?

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