mirror of
https://github.com/nasa/trick.git
synced 2025-01-18 18:56:31 +00:00
Restore debug functions #341
This commit is contained in:
parent
ef1405c3be
commit
bdcfbb4e3a
@ -274,3 +274,30 @@ bool ClassValues::isCompat15() {
|
||||
bool ClassValues::isInStandardNamespace() {
|
||||
return namespaces.size() && !namespaces[0].compare("std");
|
||||
}
|
||||
|
||||
std::ostream & operator << (std::ostream & ostream, ClassValues & cv) {
|
||||
ostream << " name = " << cv.name << std::endl ;
|
||||
ostream << " mangled_name = " << cv.mangled_type_name << std::endl ;
|
||||
ostream << " file_name = " << cv.file_name << std::endl ;
|
||||
ostream << " namespaces =" ;
|
||||
for (auto& name : cv.getNamespaces()) {
|
||||
ostream << " " << name ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " parent classes =" ;
|
||||
for (auto& clazz : cv.getContainerClasses()) {
|
||||
ostream << " " << clazz ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " has_init_attr_friend = " << cv.has_init_attr_friend << std::endl ;
|
||||
ostream << " is_pod = " << cv.is_pod << std::endl ;
|
||||
ostream << " is_abstract = " << cv.is_abstract << std::endl ;
|
||||
ostream << " has_default_constructor = " << cv.has_default_constructor << std::endl ;
|
||||
ostream << " has_public_destructor = " << cv.has_public_destructor << std::endl ;
|
||||
|
||||
for (auto& field : cv.getFieldDescriptions()) {
|
||||
ostream << field << std::endl ;
|
||||
}
|
||||
|
||||
return ostream ;
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ class ClassValues : public ConstructValues {
|
||||
bool isCompat15() ;
|
||||
bool isInStandardNamespace();
|
||||
|
||||
friend std::ostream & operator << (std::ostream & os , ClassValues & cv ) ;
|
||||
|
||||
private:
|
||||
std::vector< FieldDescription * > field_descripts ;
|
||||
|
||||
|
@ -40,6 +40,7 @@ void ConstructValues::getNamespacesAndClasses( const clang::DeclContext * Ctx )
|
||||
for (ContextsTy::reverse_iterator I = Contexts.rbegin(), E = Contexts.rend(); I != E; ++I) {
|
||||
if (const clang::NamespaceDecl *nd = clang::dyn_cast<clang::NamespaceDecl>(*I)) {
|
||||
if (! nd->isAnonymousNamespace()) {
|
||||
//std::cout << "namespace " << nd->getIdentifier()->getName().str() << std::endl ;
|
||||
std::string temp_name = nd->getIdentifier()->getName().str() ;
|
||||
if ( temp_name.compare("std") and temp_name.compare("__1")) {
|
||||
addNamespace(nd->getIdentifier()->getName().str()) ;
|
||||
@ -47,6 +48,7 @@ void ConstructValues::getNamespacesAndClasses( const clang::DeclContext * Ctx )
|
||||
}
|
||||
} else if (const clang::RecordDecl *rd = clang::dyn_cast<clang::RecordDecl>(*I)) {
|
||||
if (rd->getIdentifier()) {
|
||||
//std::cout << "in class " << rd->getName().str() << std::endl ;
|
||||
if (const clang::ClassTemplateSpecializationDecl *td = clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(*I)) {
|
||||
std::string text;
|
||||
llvm::raw_string_ostream stream(text);
|
||||
|
@ -17,3 +17,24 @@ void EnumValues::setHasDefinition( bool in ) {
|
||||
bool EnumValues::getHasDefinition() {
|
||||
return has_definition ;
|
||||
}
|
||||
|
||||
std::ostream & operator << (std::ostream & ostream , EnumValues & ev ) {
|
||||
ostream << " name = " << ev.name << std::endl ;
|
||||
ostream << " file_name = " << ev.file_name << std::endl ;
|
||||
ostream << " namespaces =" ;
|
||||
for (auto& name : ev.getNamespaces()) {
|
||||
ostream << " " << name ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " parent classes =" ;
|
||||
for (auto& clazz : ev.getContainerClasses()) {
|
||||
ostream << " " << clazz ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
|
||||
for (auto& pair : ev.getPairs()) {
|
||||
ostream << " " << pair.first << " " << pair.second << std::endl ;
|
||||
}
|
||||
|
||||
return ostream ;
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ class EnumValues : public ConstructValues {
|
||||
return enum_values;
|
||||
}
|
||||
|
||||
friend std::ostream & operator << (std::ostream & os , EnumValues & ev ) ;
|
||||
|
||||
private:
|
||||
|
||||
/** List of enums and their values */
|
||||
|
@ -524,3 +524,42 @@ int FieldDescription::getArrayDim(unsigned int dim_num) {
|
||||
void FieldDescription::addArrayDim( int in_dim ) {
|
||||
array_sizes[num_dims++] = in_dim ;
|
||||
}
|
||||
|
||||
std::ostream & operator << (std::ostream & ostream , FieldDescription & fieldDescription ) {
|
||||
ostream << " name = " << fieldDescription.name << std::endl ;
|
||||
ostream << " file_name = " << fieldDescription.file_name << std::endl ;
|
||||
ostream << " namespaces =" ;
|
||||
for (auto& name : fieldDescription.getNamespaces()) {
|
||||
ostream << " " << fieldDescription ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " parent classes =" ;
|
||||
for (auto& clazz : fieldDescription.getContainerClasses()) {
|
||||
ostream << " " << clazz ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " line_no = " << fieldDescription.line_no << std::endl ;
|
||||
ostream << " container_class = " << fieldDescription.container_class << std::endl ;
|
||||
ostream << " type_name = " << fieldDescription.type_name << std::endl ;
|
||||
ostream << " mangled_type_name = " << fieldDescription.mangled_type_name << std::endl ;
|
||||
ostream << " type_enum_string = " << fieldDescription.type_enum_string << std::endl ;
|
||||
ostream << " units = " << fieldDescription.units << std::endl ;
|
||||
ostream << " io = " << fieldDescription.io << std::endl ;
|
||||
ostream << " description = " << fieldDescription.description << std::endl ;
|
||||
ostream << " access = " << fieldDescription.access << std::endl ;
|
||||
ostream << " is_bitfield = " << fieldDescription.is_bitfield << std::endl ;
|
||||
ostream << " bitfield_width = " << fieldDescription.bitfield_width << std::endl ;
|
||||
ostream << " bitfield_start_bit = " << fieldDescription.bitfield_start_bit << std::endl ;
|
||||
ostream << " bitfield_word_offset = " << fieldDescription.bitfield_word_offset << std::endl ;
|
||||
ostream << " num_dims = " << fieldDescription.num_dims << std::endl ;
|
||||
ostream << " array_sizes =" ;
|
||||
for( unsigned int ii = 0 ; ii < 8 ; ii++ ) {
|
||||
ostream << " " << fieldDescription.array_sizes[ii] ;
|
||||
}
|
||||
ostream << std::endl ;
|
||||
ostream << " is_enum = " << fieldDescription.is_enum << std::endl ;
|
||||
ostream << " is_record = " << fieldDescription.is_record << std::endl ;
|
||||
ostream << " is_static = " << fieldDescription.is_static << std::endl ;
|
||||
|
||||
return ostream ;
|
||||
}
|
||||
|
@ -93,6 +93,8 @@ class FieldDescription : public ConstructValues {
|
||||
/** Adds an array dimension to the field */
|
||||
void addArrayDim( int in_dim ) ;
|
||||
|
||||
friend std::ostream & operator << (std::ostream & os , FieldDescription & cv ) ;
|
||||
|
||||
private:
|
||||
|
||||
/** Line number in current file where field is */
|
||||
|
@ -296,7 +296,7 @@ bool FieldVisitor::ProcessTemplate(std::string in_name , clang::CXXRecordDecl *
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << "Added template class from FieldVisitor ProcessTemplate " ;
|
||||
std::cout << in_name << std::endl ;
|
||||
//std::cout << *fdes << std::endl ;
|
||||
std::cout << *fdes << std::endl ;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user