Changeset fdbd4fd


Ignore:
Timestamp:
May 13, 2019, 4:55:27 PM (2 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
9b81fed
Parents:
336d0b3
Message:

Add dynamic_cast as method to ptr_base

Location:
src/AST
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.hpp

    r336d0b3 rfdbd4fd  
    133133        operator const node_t * const() const { return node; }
    134134
     135        template<typename o_node_t>
     136        const o_node_t * as() const { return dynamic_cast<o_node_t *>(node); }
     137
    135138        using ptr = const node_t *;
    136139
  • src/AST/porting.md

    r336d0b3 rfdbd4fd  
    33## Pointer Types ##
    44* 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)`
    79
    810## Visitors ##
     
    5658* Strong justification required for private fields
    5759  * No `get_` prefix on getters (including for generated fields)
     60    * exception is `DeclWithType::get_type()`
    5861* Notable changes:
    5962  * for concision and consistency with subclasses:
     
    108111* Still a `std::list` for children, rather than `std::vector`
    109112  * 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.