source: src/Parser/TypeData.h@ 0720e049

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 0720e049 was 6b0b624, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

change #ifndef to #pragma once

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