source: src/AST/Node.cpp @ ca8704f

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since ca8704f was 733074e, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Removed stub for toString by moving to a more precise Stub

  • Property mode set to 100644
File size: 17.1 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// Node.hpp --
8//
9// Author           : Thierry Delisle
10// Created On       : Thu May 16 14:16:00 2019
11// Last Modified By :
12// Last Modified On :
13// Update Count     :
14//
15
16#include "Node.hpp"
17#include "Fwd.hpp"
18
19#include <iostream>
20
21#include "Attribute.hpp"
22#include "Decl.hpp"
23#include "Expr.hpp"
24#include "Init.hpp"
25#include "Stmt.hpp"
26#include "Type.hpp"
27#include "TypeSubstitution.hpp"
28
29template< typename node_t, enum ast::Node::ref_type ref_t >
30void ast::ptr_base<node_t, ref_t>::_inc( const node_t * node ) { node->increment(ref_t); }
31
32template< typename node_t, enum ast::Node::ref_type ref_t >
33void ast::ptr_base<node_t, ref_t>::_dec( const node_t * node ) { node->decrement(ref_t); }
34
35/// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere.
36/// Returns a mutable version of the pointer in this node.
37template< typename node_t, enum ast::Node::ref_type ref_t >
38node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) {
39        // ensure ownership of `n` by this node to avoid spurious single-owner mutates
40        assign( n );
41        // get mutable version of `n`
42        auto r = mutate( node );
43        // re-assign mutable version in case `mutate()` produced a new pointer
44        assign( r );
45        return r;
46}
47
48std::ostream & ast::operator<< ( std::ostream & out, const ast::Node * node ) {
49        (void)node;
50        #warning unimplemented
51        assertf(false, "Unimplemented");
52        return out;
53}
54
55template class ast::ptr_base< ast::Node, ast::Node::ref_type::weak >;
56template class ast::ptr_base< ast::Node, ast::Node::ref_type::strong >;
57template class ast::ptr_base< ast::ParseNode, ast::Node::ref_type::weak >;
58template class ast::ptr_base< ast::ParseNode, ast::Node::ref_type::strong >;
59template class ast::ptr_base< ast::Decl, ast::Node::ref_type::weak >;
60template class ast::ptr_base< ast::Decl, ast::Node::ref_type::strong >;
61template class ast::ptr_base< ast::DeclWithType, ast::Node::ref_type::weak >;
62template class ast::ptr_base< ast::DeclWithType, ast::Node::ref_type::strong >;
63template class ast::ptr_base< ast::ObjectDecl, ast::Node::ref_type::weak >;
64template class ast::ptr_base< ast::ObjectDecl, ast::Node::ref_type::strong >;
65template class ast::ptr_base< ast::FunctionDecl, ast::Node::ref_type::weak >;
66template class ast::ptr_base< ast::FunctionDecl, ast::Node::ref_type::strong >;
67template class ast::ptr_base< ast::AggregateDecl, ast::Node::ref_type::weak >;
68template class ast::ptr_base< ast::AggregateDecl, ast::Node::ref_type::strong >;
69template class ast::ptr_base< ast::StructDecl, ast::Node::ref_type::weak >;
70template class ast::ptr_base< ast::StructDecl, ast::Node::ref_type::strong >;
71template class ast::ptr_base< ast::UnionDecl, ast::Node::ref_type::weak >;
72template class ast::ptr_base< ast::UnionDecl, ast::Node::ref_type::strong >;
73template class ast::ptr_base< ast::EnumDecl, ast::Node::ref_type::weak >;
74template class ast::ptr_base< ast::EnumDecl, ast::Node::ref_type::strong >;
75template class ast::ptr_base< ast::TraitDecl, ast::Node::ref_type::weak >;
76template class ast::ptr_base< ast::TraitDecl, ast::Node::ref_type::strong >;
77template class ast::ptr_base< ast::NamedTypeDecl, ast::Node::ref_type::weak >;
78template class ast::ptr_base< ast::NamedTypeDecl, ast::Node::ref_type::strong >;
79template class ast::ptr_base< ast::TypeDecl, ast::Node::ref_type::weak >;
80template class ast::ptr_base< ast::TypeDecl, ast::Node::ref_type::strong >;
81template class ast::ptr_base< ast::TypedefDecl, ast::Node::ref_type::weak >;
82template class ast::ptr_base< ast::TypedefDecl, ast::Node::ref_type::strong >;
83template class ast::ptr_base< ast::AsmDecl, ast::Node::ref_type::weak >;
84template class ast::ptr_base< ast::AsmDecl, ast::Node::ref_type::strong >;
85template class ast::ptr_base< ast::StaticAssertDecl, ast::Node::ref_type::weak >;
86template class ast::ptr_base< ast::StaticAssertDecl, ast::Node::ref_type::strong >;
87template class ast::ptr_base< ast::Stmt, ast::Node::ref_type::weak >;
88template class ast::ptr_base< ast::Stmt, ast::Node::ref_type::strong >;
89template class ast::ptr_base< ast::CompoundStmt, ast::Node::ref_type::weak >;
90template class ast::ptr_base< ast::CompoundStmt, ast::Node::ref_type::strong >;
91template class ast::ptr_base< ast::ExprStmt, ast::Node::ref_type::weak >;
92template class ast::ptr_base< ast::ExprStmt, ast::Node::ref_type::strong >;
93template class ast::ptr_base< ast::AsmStmt, ast::Node::ref_type::weak >;
94template class ast::ptr_base< ast::AsmStmt, ast::Node::ref_type::strong >;
95template class ast::ptr_base< ast::DirectiveStmt, ast::Node::ref_type::weak >;
96template class ast::ptr_base< ast::DirectiveStmt, ast::Node::ref_type::strong >;
97template class ast::ptr_base< ast::IfStmt, ast::Node::ref_type::weak >;
98template class ast::ptr_base< ast::IfStmt, ast::Node::ref_type::strong >;
99template class ast::ptr_base< ast::WhileStmt, ast::Node::ref_type::weak >;
100template class ast::ptr_base< ast::WhileStmt, ast::Node::ref_type::strong >;
101template class ast::ptr_base< ast::ForStmt, ast::Node::ref_type::weak >;
102template class ast::ptr_base< ast::ForStmt, ast::Node::ref_type::strong >;
103template class ast::ptr_base< ast::SwitchStmt, ast::Node::ref_type::weak >;
104template class ast::ptr_base< ast::SwitchStmt, ast::Node::ref_type::strong >;
105template class ast::ptr_base< ast::CaseStmt, ast::Node::ref_type::weak >;
106template class ast::ptr_base< ast::CaseStmt, ast::Node::ref_type::strong >;
107template class ast::ptr_base< ast::BranchStmt, ast::Node::ref_type::weak >;
108template class ast::ptr_base< ast::BranchStmt, ast::Node::ref_type::strong >;
109template class ast::ptr_base< ast::ReturnStmt, ast::Node::ref_type::weak >;
110template class ast::ptr_base< ast::ReturnStmt, ast::Node::ref_type::strong >;
111template class ast::ptr_base< ast::ThrowStmt, ast::Node::ref_type::weak >;
112template class ast::ptr_base< ast::ThrowStmt, ast::Node::ref_type::strong >;
113template class ast::ptr_base< ast::TryStmt, ast::Node::ref_type::weak >;
114template class ast::ptr_base< ast::TryStmt, ast::Node::ref_type::strong >;
115template class ast::ptr_base< ast::CatchStmt, ast::Node::ref_type::weak >;
116template class ast::ptr_base< ast::CatchStmt, ast::Node::ref_type::strong >;
117template class ast::ptr_base< ast::FinallyStmt, ast::Node::ref_type::weak >;
118template class ast::ptr_base< ast::FinallyStmt, ast::Node::ref_type::strong >;
119template class ast::ptr_base< ast::WaitForStmt, ast::Node::ref_type::weak >;
120template class ast::ptr_base< ast::WaitForStmt, ast::Node::ref_type::strong >;
121template class ast::ptr_base< ast::WithStmt, ast::Node::ref_type::weak >;
122template class ast::ptr_base< ast::WithStmt, ast::Node::ref_type::strong >;
123template class ast::ptr_base< ast::DeclStmt, ast::Node::ref_type::weak >;
124template class ast::ptr_base< ast::DeclStmt, ast::Node::ref_type::strong >;
125template class ast::ptr_base< ast::NullStmt, ast::Node::ref_type::weak >;
126template class ast::ptr_base< ast::NullStmt, ast::Node::ref_type::strong >;
127template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::weak >;
128template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::strong >;
129template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >;
130template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >;
131template class ast::ptr_base< ast::ApplicationExpr, ast::Node::ref_type::weak >;
132template class ast::ptr_base< ast::ApplicationExpr, ast::Node::ref_type::strong >;
133template class ast::ptr_base< ast::UntypedExpr, ast::Node::ref_type::weak >;
134template class ast::ptr_base< ast::UntypedExpr, ast::Node::ref_type::strong >;
135template class ast::ptr_base< ast::NameExpr, ast::Node::ref_type::weak >;
136template class ast::ptr_base< ast::NameExpr, ast::Node::ref_type::strong >;
137template class ast::ptr_base< ast::AddressExpr, ast::Node::ref_type::weak >;
138template class ast::ptr_base< ast::AddressExpr, ast::Node::ref_type::strong >;
139template class ast::ptr_base< ast::LabelAddressExpr, ast::Node::ref_type::weak >;
140template class ast::ptr_base< ast::LabelAddressExpr, ast::Node::ref_type::strong >;
141template class ast::ptr_base< ast::CastExpr, ast::Node::ref_type::weak >;
142template class ast::ptr_base< ast::CastExpr, ast::Node::ref_type::strong >;
143template class ast::ptr_base< ast::KeywordCastExpr, ast::Node::ref_type::weak >;
144template class ast::ptr_base< ast::KeywordCastExpr, ast::Node::ref_type::strong >;
145template class ast::ptr_base< ast::VirtualCastExpr, ast::Node::ref_type::weak >;
146template class ast::ptr_base< ast::VirtualCastExpr, ast::Node::ref_type::strong >;
147template class ast::ptr_base< ast::MemberExpr, ast::Node::ref_type::weak >;
148template class ast::ptr_base< ast::MemberExpr, ast::Node::ref_type::strong >;
149template class ast::ptr_base< ast::UntypedMemberExpr, ast::Node::ref_type::weak >;
150template class ast::ptr_base< ast::UntypedMemberExpr, ast::Node::ref_type::strong >;
151template class ast::ptr_base< ast::VariableExpr, ast::Node::ref_type::weak >;
152template class ast::ptr_base< ast::VariableExpr, ast::Node::ref_type::strong >;
153template class ast::ptr_base< ast::ConstantExpr, ast::Node::ref_type::weak >;
154template class ast::ptr_base< ast::ConstantExpr, ast::Node::ref_type::strong >;
155template class ast::ptr_base< ast::SizeofExpr, ast::Node::ref_type::weak >;
156template class ast::ptr_base< ast::SizeofExpr, ast::Node::ref_type::strong >;
157template class ast::ptr_base< ast::AlignofExpr, ast::Node::ref_type::weak >;
158template class ast::ptr_base< ast::AlignofExpr, ast::Node::ref_type::strong >;
159template class ast::ptr_base< ast::UntypedOffsetofExpr, ast::Node::ref_type::weak >;
160template class ast::ptr_base< ast::UntypedOffsetofExpr, ast::Node::ref_type::strong >;
161template class ast::ptr_base< ast::OffsetofExpr, ast::Node::ref_type::weak >;
162template class ast::ptr_base< ast::OffsetofExpr, ast::Node::ref_type::strong >;
163template class ast::ptr_base< ast::OffsetPackExpr, ast::Node::ref_type::weak >;
164template class ast::ptr_base< ast::OffsetPackExpr, ast::Node::ref_type::strong >;
165template class ast::ptr_base< ast::LogicalExpr, ast::Node::ref_type::weak >;
166template class ast::ptr_base< ast::LogicalExpr, ast::Node::ref_type::strong >;
167template class ast::ptr_base< ast::ConditionalExpr, ast::Node::ref_type::weak >;
168template class ast::ptr_base< ast::ConditionalExpr, ast::Node::ref_type::strong >;
169template class ast::ptr_base< ast::CommaExpr, ast::Node::ref_type::weak >;
170template class ast::ptr_base< ast::CommaExpr, ast::Node::ref_type::strong >;
171template class ast::ptr_base< ast::TypeExpr, ast::Node::ref_type::weak >;
172template class ast::ptr_base< ast::TypeExpr, ast::Node::ref_type::strong >;
173template class ast::ptr_base< ast::AsmExpr, ast::Node::ref_type::weak >;
174template class ast::ptr_base< ast::AsmExpr, ast::Node::ref_type::strong >;
175template class ast::ptr_base< ast::ImplicitCopyCtorExpr, ast::Node::ref_type::weak >;
176template class ast::ptr_base< ast::ImplicitCopyCtorExpr, ast::Node::ref_type::strong >;
177template class ast::ptr_base< ast::ConstructorExpr, ast::Node::ref_type::weak >;
178template class ast::ptr_base< ast::ConstructorExpr, ast::Node::ref_type::strong >;
179template class ast::ptr_base< ast::CompoundLiteralExpr, ast::Node::ref_type::weak >;
180template class ast::ptr_base< ast::CompoundLiteralExpr, ast::Node::ref_type::strong >;
181template class ast::ptr_base< ast::RangeExpr, ast::Node::ref_type::weak >;
182template class ast::ptr_base< ast::RangeExpr, ast::Node::ref_type::strong >;
183template class ast::ptr_base< ast::UntypedTupleExpr, ast::Node::ref_type::weak >;
184template class ast::ptr_base< ast::UntypedTupleExpr, ast::Node::ref_type::strong >;
185template class ast::ptr_base< ast::TupleExpr, ast::Node::ref_type::weak >;
186template class ast::ptr_base< ast::TupleExpr, ast::Node::ref_type::strong >;
187template class ast::ptr_base< ast::TupleIndexExpr, ast::Node::ref_type::weak >;
188template class ast::ptr_base< ast::TupleIndexExpr, ast::Node::ref_type::strong >;
189template class ast::ptr_base< ast::TupleAssignExpr, ast::Node::ref_type::weak >;
190template class ast::ptr_base< ast::TupleAssignExpr, ast::Node::ref_type::strong >;
191template class ast::ptr_base< ast::StmtExpr, ast::Node::ref_type::weak >;
192template class ast::ptr_base< ast::StmtExpr, ast::Node::ref_type::strong >;
193template class ast::ptr_base< ast::UniqueExpr, ast::Node::ref_type::weak >;
194template class ast::ptr_base< ast::UniqueExpr, ast::Node::ref_type::strong >;
195template class ast::ptr_base< ast::UntypedInitExpr, ast::Node::ref_type::weak >;
196template class ast::ptr_base< ast::UntypedInitExpr, ast::Node::ref_type::strong >;
197template class ast::ptr_base< ast::InitExpr, ast::Node::ref_type::weak >;
198template class ast::ptr_base< ast::InitExpr, ast::Node::ref_type::strong >;
199template class ast::ptr_base< ast::DeletedExpr, ast::Node::ref_type::weak >;
200template class ast::ptr_base< ast::DeletedExpr, ast::Node::ref_type::strong >;
201template class ast::ptr_base< ast::DefaultArgExpr, ast::Node::ref_type::weak >;
202template class ast::ptr_base< ast::DefaultArgExpr, ast::Node::ref_type::strong >;
203template class ast::ptr_base< ast::GenericExpr, ast::Node::ref_type::weak >;
204template class ast::ptr_base< ast::GenericExpr, ast::Node::ref_type::strong >;
205template class ast::ptr_base< ast::Type, ast::Node::ref_type::weak >;
206template class ast::ptr_base< ast::Type, ast::Node::ref_type::strong >;
207template class ast::ptr_base< ast::VoidType, ast::Node::ref_type::weak >;
208template class ast::ptr_base< ast::VoidType, ast::Node::ref_type::strong >;
209template class ast::ptr_base< ast::BasicType, ast::Node::ref_type::weak >;
210template class ast::ptr_base< ast::BasicType, ast::Node::ref_type::strong >;
211template class ast::ptr_base< ast::PointerType, ast::Node::ref_type::weak >;
212template class ast::ptr_base< ast::PointerType, ast::Node::ref_type::strong >;
213template class ast::ptr_base< ast::ArrayType, ast::Node::ref_type::weak >;
214template class ast::ptr_base< ast::ArrayType, ast::Node::ref_type::strong >;
215template class ast::ptr_base< ast::ReferenceType, ast::Node::ref_type::weak >;
216template class ast::ptr_base< ast::ReferenceType, ast::Node::ref_type::strong >;
217template class ast::ptr_base< ast::QualifiedType, ast::Node::ref_type::weak >;
218template class ast::ptr_base< ast::QualifiedType, ast::Node::ref_type::strong >;
219template class ast::ptr_base< ast::FunctionType, ast::Node::ref_type::weak >;
220template class ast::ptr_base< ast::FunctionType, ast::Node::ref_type::strong >;
221template class ast::ptr_base< ast::ReferenceToType, ast::Node::ref_type::weak >;
222template class ast::ptr_base< ast::ReferenceToType, ast::Node::ref_type::strong >;
223template class ast::ptr_base< ast::StructInstType, ast::Node::ref_type::weak >;
224template class ast::ptr_base< ast::StructInstType, ast::Node::ref_type::strong >;
225template class ast::ptr_base< ast::UnionInstType, ast::Node::ref_type::weak >;
226template class ast::ptr_base< ast::UnionInstType, ast::Node::ref_type::strong >;
227template class ast::ptr_base< ast::EnumInstType, ast::Node::ref_type::weak >;
228template class ast::ptr_base< ast::EnumInstType, ast::Node::ref_type::strong >;
229template class ast::ptr_base< ast::TraitInstType, ast::Node::ref_type::weak >;
230template class ast::ptr_base< ast::TraitInstType, ast::Node::ref_type::strong >;
231template class ast::ptr_base< ast::TypeInstType, ast::Node::ref_type::weak >;
232template class ast::ptr_base< ast::TypeInstType, ast::Node::ref_type::strong >;
233template class ast::ptr_base< ast::TupleType, ast::Node::ref_type::weak >;
234template class ast::ptr_base< ast::TupleType, ast::Node::ref_type::strong >;
235template class ast::ptr_base< ast::TypeofType, ast::Node::ref_type::weak >;
236template class ast::ptr_base< ast::TypeofType, ast::Node::ref_type::strong >;
237template class ast::ptr_base< ast::VarArgsType, ast::Node::ref_type::weak >;
238template class ast::ptr_base< ast::VarArgsType, ast::Node::ref_type::strong >;
239template class ast::ptr_base< ast::ZeroType, ast::Node::ref_type::weak >;
240template class ast::ptr_base< ast::ZeroType, ast::Node::ref_type::strong >;
241template class ast::ptr_base< ast::OneType, ast::Node::ref_type::weak >;
242template class ast::ptr_base< ast::OneType, ast::Node::ref_type::strong >;
243template class ast::ptr_base< ast::GlobalScopeType, ast::Node::ref_type::weak >;
244template class ast::ptr_base< ast::GlobalScopeType, ast::Node::ref_type::strong >;
245template class ast::ptr_base< ast::Designation, ast::Node::ref_type::weak >;
246template class ast::ptr_base< ast::Designation, ast::Node::ref_type::strong >;
247template class ast::ptr_base< ast::Init, ast::Node::ref_type::weak >;
248template class ast::ptr_base< ast::Init, ast::Node::ref_type::strong >;
249template class ast::ptr_base< ast::SingleInit, ast::Node::ref_type::weak >;
250template class ast::ptr_base< ast::SingleInit, ast::Node::ref_type::strong >;
251template class ast::ptr_base< ast::ListInit, ast::Node::ref_type::weak >;
252template class ast::ptr_base< ast::ListInit, ast::Node::ref_type::strong >;
253template class ast::ptr_base< ast::ConstructorInit, ast::Node::ref_type::weak >;
254template class ast::ptr_base< ast::ConstructorInit, ast::Node::ref_type::strong >;
255template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::weak >;
256template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::strong >;
257template class ast::ptr_base< ast::TypeSubstitution, ast::Node::ref_type::weak >;
258template class ast::ptr_base< ast::TypeSubstitution, ast::Node::ref_type::strong >;
Note: See TracBrowser for help on using the repository browser.