mirror of
https://github.com/nasa/trick.git
synced 2025-01-29 15:43:57 +00:00
Add support for references in MM::ref_name
Add an AO_DEREFERENCE ADDRESS_NODE to R->address_path and dereference the address for REF2->address
This commit is contained in:
parent
8e3726eb98
commit
c428bce49d
@ -63,6 +63,14 @@ bool PrintFileContentsBase::isPrintable( ClassValues * c , FieldDescription * fd
|
||||
if ( fdes->isSTL() and fdes->getNumDims() ) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* It is not possible to take the address of a reference as the referred-to variable's address
|
||||
* is always returned. As such, the init_attr function cannot obtain the absolute address for
|
||||
* static reference variables.
|
||||
*/
|
||||
if ( fdes->isStatic() && fdes->isReference() ) {
|
||||
return false;
|
||||
}
|
||||
if ( fdes->getAccess() == clang::AS_public || (!fdes->isStatic() && !global_compat15 && !c->isCompat15())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -99,6 +99,15 @@ int Trick::MemoryManager::ref_name(REF2 * R, char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
if (attr->mods & 1) {
|
||||
ADDRESS_NODE * address_node = new ADDRESS_NODE ;
|
||||
address_node->operator_ = AO_DEREFERENCE ;
|
||||
address_node->operand.address = NULL ;
|
||||
DLL_AddTail(address_node , R->address_path) ;
|
||||
|
||||
addr = *(char**)addr;
|
||||
}
|
||||
|
||||
/* Save the address and next attributes in the REF structure.
|
||||
If the attributes are dynamically-allocated, reference attributes
|
||||
then free them so we don't leak memory.
|
||||
|
Loading…
x
Reference in New Issue
Block a user