source: src/Parser/TypeData.h @ e496303

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

change type of type qualifiers to bit fields and fix uninitialized fields in aggregate

  • Property mode set to 100644
File size: 3.7 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
11// Last Modified By : Peter A. Buhr
[e496303]12// Last Modified On : Tue Mar 14 16:51:26 2017
13// Update Count     : 181
[b87a5ed]14//
15
[51b7345]16#ifndef TYPEDATA_H
17#define TYPEDATA_H
18
19#include "ParseNode.h"
20#include "SynTree/Type.h"
21
[c8ffe20b]22struct TypeData {
[faddbd8]23        enum Kind { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
24                                SymbolicInst, Tuple, Typeof, Builtin, Unknown };
[b87a5ed]25
26        struct Aggregate_t {
[68cd1ce]27                DeclarationNode::Aggregate kind;
[2298f728]28                const std::string * name;
[7ee14bb7]29                DeclarationNode * params;
[2298f728]30                ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
[7ee14bb7]31                DeclarationNode * fields;
[5d125e4]32                bool body;
[b87a5ed]33        };
34
35        struct AggInst_t {
[7ee14bb7]36                TypeData * aggregate;
37                ExpressionNode * params;
[43c89a7]38                bool hoistType;
[b87a5ed]39        };
40
41        struct Array_t {
[7ee14bb7]42                ExpressionNode * dimension;
[b87a5ed]43                bool isVarLen;
44                bool isStatic;
45        };
46
47        struct Enumeration_t {
[2298f728]48                const std::string * name;
[7ee14bb7]49                DeclarationNode * constants;
[ca1a547]50                bool body;
[b87a5ed]51        };
52
53        struct Function_t {
[3a5131ed]54                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
55                mutable DeclarationNode * idList;                               // old-style
56                mutable DeclarationNode * oldDeclList;
[7ee14bb7]57                StatementNode * body;
[b87a5ed]58                bool newStyle;
59        };
60
61        struct Symbolic_t {
[2298f728]62                const std::string * name;
[721f17a]63                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
[7ee14bb7]64                DeclarationNode * params;
65                ExpressionNode * actuals;
66                DeclarationNode * assertions;
[b87a5ed]67        };
68
[28307be]69        Kind kind;
[413ad05]70        TypeData * base;
[5b639ee]71        DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
72        DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
73        DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
74        DeclarationNode::Length length = DeclarationNode::NoLength;
[148f7290]75        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
[c3396e0]76
[e496303]77        DeclarationNode::TypeQualifiers typeQualifiers;
[413ad05]78        DeclarationNode * forall;
79
[c3396e0]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;
[b87a5ed]90
[413ad05]91        TypeData( Kind k = Unknown );
92        ~TypeData();
93        void print( std::ostream &, int indent = 0 ) const;
94        TypeData * clone() const;
[51b7345]95};
96
[413ad05]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 * );
[c0aa336]103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
[43c89a7]104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
[413ad05]105ReferenceToType * buildAggInst( const TypeData * );
106TypeDecl * buildVariable( const TypeData * );
[c0aa336]107EnumDecl * buildEnum( const TypeData *, std::list< Attribute * > );
[413ad05]108TypeInstType * buildSymbolicInst( const TypeData * );
109TupleType * buildTuple( const TypeData * );
110TypeofType * buildTypeof( const TypeData * );
[a7c90d4]111Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClasses, Expression *, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
[413ad05]112FunctionType * buildFunction( const TypeData * );
[3a5131ed]113void buildKRFunction( const TypeData::Function_t & function );
[413ad05]114
[c8ffe20b]115#endif // TYPEDATA_H
[b87a5ed]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.