ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since d893266a was
a5f0529,
checked in by Andrew Beach <ajbeach@…>, 7 years ago
|
Virtual casts have been added. They still require a lot of hand coded support to work but for simple cases it should be enough.
|
-
Property mode set to
100644
|
File size:
854 bytes
|
Rev | Line | |
---|
[a5f0529] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 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 | // virtual.c -- |
---|
| 8 | // |
---|
| 9 | // Author : Andrew Beach |
---|
| 10 | // Created On : Tus Jul 11 15:10:00 2017 |
---|
| 11 | // Last Modified By : Andrew Beach |
---|
| 12 | // Last Modified On : Wed Jul 26 14:24:00 2017 |
---|
| 13 | // Update Count : 1 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #include "virtual.h" |
---|
| 17 | |
---|
| 18 | int __cfa__is_parent( struct __cfa__parent_vtable const * parent, |
---|
| 19 | struct __cfa__parent_vtable const * child ) { |
---|
| 20 | do { |
---|
| 21 | if ( parent == child ) |
---|
| 22 | return 1; |
---|
| 23 | child = child->parent; |
---|
| 24 | } while ( child ); |
---|
| 25 | return 0; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent, |
---|
| 29 | struct __cfa__parent_vtable const * const * child ) { |
---|
| 30 | return (__cfa__is_parent(parent, *child)) ? (void *)child : (void *)0; |
---|
| 31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.