Ignore privacy

Mostly working.  This removes the use of offsetof from all I/O code.  This was
the only reason we needed friends.  In it's place we put the offset value that
clang has calculated for the field.  Still need to work on virtually inherited
classes and confirm bitfields.

refs #218
This commit is contained in:
Alex Lin
2016-04-06 08:23:23 -05:00
parent fc98f6cf0a
commit 7dcc65d0bd
11 changed files with 114 additions and 45 deletions

View File

@ -74,25 +74,22 @@ void PrintFileContentsBase::print_close_extern_c(std::ofstream & outfile) {
*/
bool PrintFileContentsBase::determinePrintAttr( ClassValues * c , FieldDescription * fdes ) {
if ( fdes->getTypeName().compare("void") and fdes->getIO() != 0 and fdes->getEnumString().compare("TRICK_VOID")) {
if ( fdes->isInherited() ) {
return ((c->getHasInitAttrFriend() && fdes->getAccess() == clang::AS_protected)
|| (fdes->getAccess() == clang::AS_public)) ;
if ( fdes->isStatic() ) {
// Cannot take the address of a bitfield, attributes need the address of static variables.
// return false if we have a static bitfield
if ( fdes->isBitField() ) {
return false ;
}
if ( fdes->isInherited() ) {
return ((c->getHasInitAttrFriend() && fdes->getAccess() == clang::AS_protected)
|| (fdes->getAccess() == clang::AS_public)) ;
} else {
return (c->getHasInitAttrFriend()
|| (fdes->getAccess() == clang::AS_public)) ;
}
} else {
return (c->getHasInitAttrFriend()
|| (fdes->getAccess() == clang::AS_public)) ;
return true ;
}
#if 0
// Use this version when/if we decide to #define private public.
if ( fdes->isInherited() ) {
return ((c->getHasInitAttrFriend() && fdes->getAccess() == clang::AS_protected)
|| (fdes->getAccess() == clang::AS_public)
|| fdes->getAccessSpecFound()) ;
} else {
return (c->getHasInitAttrFriend()
|| (fdes->getAccess() == clang::AS_public)
|| fdes->getAccessSpecFound()) ;
}
#endif
}
return false ;
}