mirror of
https://github.com/nasa/trick.git
synced 2025-01-18 02:40:08 +00:00
Ignore privacy
We need to exclude STL or other template io_src code being created with they use a protected/private enumerations, just like classes. Also remove a check for a static bitfield, because you can't have a static bitfield. refs #218
This commit is contained in:
parent
f2dd53f0b5
commit
d6e01ee1c4
@ -80,6 +80,13 @@ bool CXXRecordVisitor::TraverseDecl(clang::Decl *d) {
|
|||||||
EnumVisitor evis(ci, hsd) ;
|
EnumVisitor evis(ci, hsd) ;
|
||||||
evis.TraverseDecl(ed) ;
|
evis.TraverseDecl(ed) ;
|
||||||
pa.printEnum(evis.get_enum_data()) ;
|
pa.printEnum(evis.get_enum_data()) ;
|
||||||
|
} else {
|
||||||
|
// protected and private embedded classes cannot be used outside of their class
|
||||||
|
// in our auto-generated code. Keep a set of all classes of this type so we can
|
||||||
|
// test against them.
|
||||||
|
ClassValues temp_cv ;
|
||||||
|
temp_cv.getNamespacesAndClasses(ed->getDeclContext()) ;
|
||||||
|
private_embedded_classes.insert(temp_cv.getFullyQualifiedName() + ed->getNameAsString()) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
@ -320,6 +327,9 @@ bool CXXRecordVisitor::isPrivateEmbeddedClass( std::string in_name ) {
|
|||||||
while ((pos = in_name.find("struct ")) != std::string::npos ) {
|
while ((pos = in_name.find("struct ")) != std::string::npos ) {
|
||||||
in_name.erase(pos , 7) ;
|
in_name.erase(pos , 7) ;
|
||||||
}
|
}
|
||||||
|
while ((pos = in_name.find("enum ")) != std::string::npos ) {
|
||||||
|
in_name.erase(pos , 5) ;
|
||||||
|
}
|
||||||
while ((pos = in_name.find("const ")) != std::string::npos ) {
|
while ((pos = in_name.find("const ")) != std::string::npos ) {
|
||||||
in_name.erase(pos , 6) ;
|
in_name.erase(pos , 6) ;
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,6 @@ void PrintFileContents10::print_field_init_attr_stmts( std::ofstream & outfile ,
|
|||||||
|
|
||||||
// For static variables replace the offset field with the address of the static variable
|
// For static variables replace the offset field with the address of the static variable
|
||||||
if ( fdes->isStatic() ) {
|
if ( fdes->isStatic() ) {
|
||||||
// NOTE: We would not be able to take the address of a static bitfield.
|
|
||||||
// Static bitfields do not get to this point, they are filtered out in determinePrintAttr
|
|
||||||
outfile << " attr" ;
|
outfile << " attr" ;
|
||||||
printNamespaces( outfile, cv , "__" ) ;
|
printNamespaces( outfile, cv , "__" ) ;
|
||||||
printContainerClasses( outfile, cv , "__" ) ;
|
printContainerClasses( outfile, cv , "__" ) ;
|
||||||
|
@ -75,11 +75,6 @@ void PrintFileContentsBase::print_close_extern_c(std::ofstream & outfile) {
|
|||||||
bool PrintFileContentsBase::determinePrintAttr( ClassValues * c , FieldDescription * fdes ) {
|
bool PrintFileContentsBase::determinePrintAttr( ClassValues * c , FieldDescription * fdes ) {
|
||||||
if ( fdes->getTypeName().compare("void") and fdes->getIO() != 0 and fdes->getEnumString().compare("TRICK_VOID")) {
|
if ( fdes->getTypeName().compare("void") and fdes->getIO() != 0 and fdes->getEnumString().compare("TRICK_VOID")) {
|
||||||
if ( fdes->isStatic() ) {
|
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() ) {
|
if ( fdes->isInherited() ) {
|
||||||
return ((c->getHasInitAttrFriend() && fdes->getAccess() == clang::AS_protected)
|
return ((c->getHasInitAttrFriend() && fdes->getAccess() == clang::AS_protected)
|
||||||
|| (fdes->getAccess() == clang::AS_public)) ;
|
|| (fdes->getAccess() == clang::AS_public)) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user