diff --git a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp index 462e6ba8..3409e086 100644 --- a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp +++ b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp @@ -429,6 +429,9 @@ bool FieldVisitor::VisitTypedefType(clang::TypedefType *tt) { } if ( tt->isEnumeralType() ) { + if ( debug_level >= 4 ) { + std::cout << " FieldVisitor VisitTypedefType enumerated" << std::endl ; + } fdes->setEnumString("TRICK_ENUMERATED") ; fdes->setEnum(true) ; std::string enum_type_name = tt->desugar().getAsString() ; @@ -534,8 +537,28 @@ bool FieldVisitor::VisitTypedefType(clang::TypedefType *tt) { fdes->setTypeName(type_name) ; fdes->setHasType(true) ; } else if ( tt->isBuiltinType() ) { + if ( debug_level >= 4 ) { + std::cout << " FieldVisitor VisitTypedefType builtintype" << std::endl ; + } const clang::BuiltinType * bt = tt->getAs() ; VisitBuiltinType((clang::BuiltinType *)bt) ; + } else if ( tt->isArrayType() || tt->isPointerType()) { + clang::QualType qt = tt->desugar() ; + if ( debug_level >= 4 ) { + std::cout << "Typedef to constant array type" << std::endl ; + qt->dump() ; + } + // Calling visit type recursively with the typedeffed type + TraverseType(qt) ; + + if ( debug_level >= 4 ) { + std::cout << "After TraverseType" << std::endl ; + std::cout << *fdes << std::endl ; + } + } else { + if ( debug_level >= 4 ) { + std::cout << "Typedef to something we don't handle yet" << std::endl ; + } } return true; } diff --git a/trick_source/codegen/Interface_Code_Gen/HeaderSearchDirs.cpp b/trick_source/codegen/Interface_Code_Gen/HeaderSearchDirs.cpp index 3adf6207..f4ef74e0 100644 --- a/trick_source/codegen/Interface_Code_Gen/HeaderSearchDirs.cpp +++ b/trick_source/codegen/Interface_Code_Gen/HeaderSearchDirs.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -138,7 +139,13 @@ void HeaderSearchDirs::AddICGExcludeDirs () { if ( ! item.empty() ) { char * resolved_path = realpath(item.c_str(), NULL) ; if ( resolved_path ) { - icg_exclude_dirs.push_back(std::string(resolved_path) + std::string("/")); + std::ifstream file_or_dir(resolved_path) ; + file_or_dir.seekg(0, std::ios::end) ; + if ( !file_or_dir.good()) { + icg_exclude_dirs.push_back(std::string(resolved_path) + std::string("/")); + } else { + icg_exclude_dirs.push_back(std::string(resolved_path)); + } } else { std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ; } @@ -160,7 +167,13 @@ void HeaderSearchDirs::AddExcludeDirs () { if ( ! item.empty() ) { char * resolved_path = realpath(item.c_str(), NULL) ; if ( resolved_path ) { - exclude_dirs.push_back(std::string(resolved_path) + std::string("/")); + std::ifstream file_or_dir(resolved_path) ; + file_or_dir.seekg(0, std::ios::end) ; + if ( !file_or_dir.good()) { + exclude_dirs.push_back(std::string(resolved_path) + std::string("/")); + } else { + exclude_dirs.push_back(std::string(resolved_path)); + } } else { std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ; } diff --git a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp index 06ff750b..2c35973f 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp @@ -180,11 +180,11 @@ bool PrintAttributes::openIOFile(std::string header_file_name) { icg_no_files.push_back(rp) ; } } else { - std::cout << "ICG skipping " << rp << " (ICG exclude dir " << + std::cout << "ICG skipping " << rp << " (ICG exclude " << hsd.getPathInICGExclude(rp) << ")" << std::endl ; } } else { - std::cout << "ICG skipping " << rp << " (exclude dir " << + std::cout << "ICG skipping " << rp << " (exclude " << hsd.getPathInExclude(rp) << ")" << std::endl ; } } else {