Changes in src/AST/porting.md [6d51bd7:fdbd4fd]
- File:
-
- 1 edited
-
src/AST/porting.md (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/porting.md
r6d51bd7 rfdbd4fd 3 3 ## Pointer Types ## 4 4 * raw pointer `T*` is used for construction, but not storage 5 * strong pointer `ast::ptr<T>` is used for an ownership relationship 6 * weak pointer `ast::readonly<T>` is used for an observation relationship 5 * `ast::ptr_base<T,R>` is a pointer to AST node `T` with reference type `R` 6 * specialization: strong pointer `ast::ptr<T>` is used for an ownership relationship 7 * specialization: weak pointer `ast::readonly<T>` is used for an observation relationship 8 * added `ast::ptr_base<T,R>::as<S>()` with same semantics as `dynamic_cast<S*>(p)` 7 9 8 10 ## Visitors ## 9 11 * `Visitor` and `Mutator` are combined into a single `ast::Visitor` class 10 * Base nodes now override ` const Node * accept( Visitor & v ) const = 0` with, e.g. `const Stmt * accept( Visitor & v ) constoverride = 0`12 * Base nodes now override `Node* accept( Visitor& v ) = 0` with, e.g. `Stmt* accept( Visitor& v ) override = 0` 11 13 * `PassVisitor` is replaced with `ast::Pass` 12 14 … … 24 26 `clone` is private to `Node` now 25 27 * still needs to be overriden to return appropriate type 26 * e.g. `private: virtual Stmt * clone() const override = 0;` 27 * because friendship is not inherited, all implementations of clone need 28 /// Must be copied in ALL derived classes 29 template<typename node_t> 30 friend auto mutate(const node_t * node); 28 * e.g. `private: virtual Stmt* clone() const override = 0;` 31 29 32 30 All leaves of the `Node` inheritance tree are now declared `final` … … 60 58 * Strong justification required for private fields 61 59 * No `get_` prefix on getters (including for generated fields) 60 * exception is `DeclWithType::get_type()` 62 61 * Notable changes: 63 62 * for concision and consistency with subclasses: … … 112 111 * Still a `std::list` for children, rather than `std::vector` 113 112 * allows more-efficient splicing for purposes of later code generation 113 114 `Type` 115 * `forall` field split off into `ParameterizedType` subclass 116 * any type that needs it can inherit from `ParameterizedType` 117 * `get_qualifiers()` replaced with accessor `qualifiers()` and mutator `set_qualifiers()` 118 * `get_CV()` replaced with `is_CV()` variants 119 * A number of features only supported on aggregates pushed down to `ReferenceToType`: 120 * `attributes`: per docs [1] GCC only supports type attributes on aggregates and typedefs 121 * suggest adding a `TypeWithAttributes` wrapper type if this proves insufficient 122 * `getAggr()` 123 * `genericSubstitution()` 124 125 `BasicType` 126 * does not inherit from `Type` to allow pointer inlining 127 * moved `Kind` before qualifiers in constructor to allow for default 128 * **TODO** move `kind`, `typeNames` into code generator 129 130 [1] https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Type-Attributes.html#Type-Attributes 131
Note:
See TracChangeset
for help on using the changeset viewer.