mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
Fixes io_src code for typedef structures.
Found that my check for embedded classes was also catching some typedef structures. This was causing some io_src code not to be generated. Changed the test so that we can differentiate between embedded classes and the typedefs. This change fixes #10 and fixes #23.
This commit is contained in:
parent
48a09d386e
commit
ea085eb9ee
@ -235,15 +235,22 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
|
||||
} SB ;
|
||||
} ;
|
||||
*/
|
||||
if ( rt->getDecl()->getIdentifier() == NULL ) {
|
||||
//std::cout << "hasNameForLinkage " << rt->getDecl()->hasNameForLinkage() << std::endl ;
|
||||
if ( rt->getDecl()->hasNameForLinkage() ) {
|
||||
if ( rt->getDecl()->getDeclName() ) {
|
||||
//std::cout << "getDeclName " << rt->getDecl()->getDeclName().getAsString() << std::endl ;
|
||||
fdes->setTypeName(rt->getDecl()->getQualifiedNameAsString()) ;
|
||||
} else {
|
||||
//std::cout << "getTypedefNameForAnonDecl " << rt->getDecl()->getTypedefNameForAnonDecl() << std::endl ;
|
||||
fdes->setTypeName(rt->getDecl()->getTypedefNameForAnonDecl()->getQualifiedNameAsString()) ;
|
||||
}
|
||||
} else {
|
||||
//rt->getDecl()->dump() ; std::cout << std::endl ;
|
||||
// io_src code not possible for anonymous struct/unions. Set the I/O to 0 to ignore it.
|
||||
if ( debug_level >= 3 ) {
|
||||
std::cout << "FieldVisitor VisitRecordType found anonymous type, setIO = 0" << std::endl ;
|
||||
}
|
||||
fdes->setIO(0) ;
|
||||
} else {
|
||||
fdes->setTypeName(rt->getDecl()->getQualifiedNameAsString()) ;
|
||||
}
|
||||
|
||||
fdes->setEnumString("TRICK_STRUCTURED") ;
|
||||
|
Loading…
Reference in New Issue
Block a user