source: src/Parser/TypeData.h @ d8548e2

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 d8548e2 was 0b0f1dd, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Propagated code location to TypeData?

  • Property mode set to 100644
File size: 4.2 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 : Fri Sep  1 23:33:45 2017
13// Update Count     : 190
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, 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
39                bool tagged;
40                const std::string * parent;
41        };
42
43        struct AggInst_t {
44                TypeData * aggregate;
45                ExpressionNode * params;
46                bool hoistType;
47        };
48
49        struct Array_t {
50                ExpressionNode * dimension;
51                bool isVarLen;
52                bool isStatic;
53        };
54
55        struct Enumeration_t {
56                const std::string * name;
57                DeclarationNode * constants;
58                bool body;
59        };
60
61        struct Function_t {
62                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
63                mutable DeclarationNode * idList;                               // old-style
64                mutable DeclarationNode * oldDeclList;
65                StatementNode * body;
66                bool newStyle;
67                ExpressionNode * withExprs;             // expressions from function's with_clause
68        };
69
70        struct Symbolic_t {
71                const std::string * name;
72                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
73                DeclarationNode * params;
74                ExpressionNode * actuals;
75                DeclarationNode * assertions;
76        };
77
78        CodeLocation location;
79
80        Kind kind;
81        TypeData * base;
82        DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
83        DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
84        DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
85        DeclarationNode::Length length = DeclarationNode::NoLength;
86        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
87
88        Type::Qualifiers qualifiers;
89        DeclarationNode * forall;
90
91        // Basic_t basic;
92        Aggregate_t aggregate;
93        AggInst_t aggInst;
94        Array_t array;
95        Enumeration_t enumeration;
96        // Variable_t variable;
97        Function_t function;
98        Symbolic_t symbolic;
99        DeclarationNode * tuple;
100        ExpressionNode * typeexpr;
101
102        TypeData( Kind k = Unknown );
103        ~TypeData();
104        void print( std::ostream &, int indent = 0 ) const;
105        TypeData * clone() const;
106};
107
108Type * typebuild( const TypeData * );
109TypeData * typeextractAggregate( const TypeData * td, bool toplevel = true );
110Type::Qualifiers buildQualifiers( const TypeData * td );
111Type * buildBasicType( const TypeData * );
112PointerType * buildPointer( const TypeData * );
113ArrayType * buildArray( const TypeData * );
114ReferenceType * buildReference( const TypeData * );
115AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
116ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
117ReferenceToType * buildAggInst( const TypeData * );
118TypeDecl * buildVariable( const TypeData * );
119EnumDecl * buildEnum( const TypeData *, std::list< Attribute * >, LinkageSpec::Spec );
120TypeInstType * buildSymbolicInst( const TypeData * );
121TupleType * buildTuple( const TypeData * );
122TypeofType * buildTypeof( const TypeData * );
123Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
124FunctionType * buildFunction( const TypeData * );
125void buildKRFunction( const TypeData::Function_t & function );
126
127// Local Variables: //
128// tab-width: 4 //
129// mode: c++ //
130// compile-command: "make install" //
131// End: //
Note: See TracBrowser for help on using the repository browser.