source: src/Parser/TypeData.h@ b826e6b

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since b826e6b was 6ea87486, checked in by Andrew Beach <ajbeach@…>, 8 years ago

That should be all the base code for 'tree structures' to work.

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