ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 04994aa was
4e13e2a,
checked in by Thierry Delisle <tdelisle@…>, 5 years ago
|
Added setting of result in Comma expression.
Added asserts in candidate finder to catch null pointers earlier.
ForAll? substituter now properly uses ShallowCopy?.
Added missing makefile.in
|
-
Property mode set to
100644
|
File size:
1.4 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 | // ForallSubstitutionTable.cpp -- |
---|
8 | // |
---|
9 | // Author : Aaron B. Moss |
---|
10 | // Created On : Thu Jun 27 14:00:00 2019 |
---|
11 | // Last Modified By : Aaron B. Moss |
---|
12 | // Last Modified On : Thu Jun 27 14:00:00 2019 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | #include "ForallSubstitutionTable.hpp" |
---|
17 | |
---|
18 | #include <cassert> |
---|
19 | #include <vector> |
---|
20 | |
---|
21 | #include "Copy.hpp" // for shallowCopy |
---|
22 | #include "Decl.hpp" |
---|
23 | #include "Node.hpp" |
---|
24 | #include "Type.hpp" |
---|
25 | #include "Visitor.hpp" |
---|
26 | |
---|
27 | namespace ast { |
---|
28 | |
---|
29 | std::vector< ptr< TypeDecl > > ForallSubstitutionTable::clone( |
---|
30 | const std::vector< ptr< TypeDecl > > & forall, Visitor & v |
---|
31 | ) { |
---|
32 | std::vector< ptr< TypeDecl > > new_forall; |
---|
33 | new_forall.reserve( forall.size() ); |
---|
34 | |
---|
35 | for ( const ast::TypeDecl * d : forall ) { |
---|
36 | // create cloned type decl and insert into substitution map before further mutation |
---|
37 | auto new_d = shallowCopy( d ); |
---|
38 | decls.insert( d, new_d ); |
---|
39 | // perform other mutations and add to output |
---|
40 | auto newer_d = v.visit( new_d ); |
---|
41 | assert( new_d == newer_d && "Newly cloned TypeDecl must retain identity" ); |
---|
42 | new_forall.emplace_back( new_d ); |
---|
43 | } |
---|
44 | |
---|
45 | return new_forall; |
---|
46 | } |
---|
47 | |
---|
48 | } |
---|
49 | |
---|
50 | // Local Variables: // |
---|
51 | // tab-width: 4 // |
---|
52 | // mode: c++ // |
---|
53 | // compile-command: "make install" // |
---|
54 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.