Changeset 52a4d69 for src/AST/Node.hpp
- Timestamp:
- Jun 5, 2020, 10:29:10 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d2de1be9
- Parents:
- 5c9b20c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r5c9b20c r52a4d69 10 10 // Created On : Wed May 8 10:27:04 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 3 13:26:00 201913 // Update Count : 512 // Last Modified On : Fri Jun 5 9:47:00 2020 13 // Update Count : 6 14 14 // 15 15 … … 243 243 const o_node_t * as() const { _check(); return dynamic_cast<const o_node_t *>(node); } 244 244 245 /// wrapper for convenient access to strict_dynamic_cast245 /// Wrapper that makes sure dynamic_cast returns non-null. 246 246 template<typename o_node_t> 247 const o_node_t * strict_as() const { _check(); return strict_dynamic_cast<const o_node_t *>(node); } 247 const o_node_t * strict_as() const { 248 if (const o_node_t * ret = as<o_node_t>()) return ret; 249 _strict_fail(); 250 } 251 252 /// Wrapper that makes sure dynamic_cast does not fail. 253 template<typename o_node_t, decltype(nullptr) null> 254 const o_node_t * strict_as() const { return node ? strict_as<o_node_t>() : nullptr; } 248 255 249 256 /// Returns a mutable version of the pointer in this node. … … 266 273 void _dec( const node_t * other, bool do_delete = true ); 267 274 void _check() const; 275 void _strict_fail() const __attribute__((noreturn)); 268 276 269 277 const node_t * node;
Note: See TracChangeset
for help on using the changeset viewer.