Ignore privacy

Adjusted code to ignore processing templates in files with ICG:(No).  This
was not being honoroed before.

refs #218
This commit is contained in:
Alex Lin 2016-04-08 08:26:57 -05:00
parent 4dad11bf45
commit 34090169fb
4 changed files with 24 additions and 8 deletions

View File

@ -13,6 +13,7 @@
#include "EnumValues.hh" #include "EnumValues.hh"
#include "FieldVisitor.hh" #include "FieldVisitor.hh"
#include "Utilities.hh" #include "Utilities.hh"
#include "CommentSaver.hh"
#include "PrintAttributes.hh" #include "PrintAttributes.hh"
extern llvm::cl::opt< int > debug_level ; extern llvm::cl::opt< int > debug_level ;
@ -129,8 +130,22 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
if ( debug_level >= 2 ) { if ( debug_level >= 2 ) {
rec->dump() ; std::cout << std::endl ; rec->dump() ; std::cout << std::endl ;
} }
// Return false to stop processing if there is no definition of this class
if ( rec->getDefinition() == NULL ) { if ( rec->getDefinition() == NULL ) {
return true ; return false ;
}
// Return false to stop processing if this header file is excluded by one of many reasons.
std::string header_file_name = getFileName(ci , rec->getRBraceLoc(), hsd) ;
char * rp = almostRealPath(header_file_name.c_str()) ;
if ( rp == NULL ||
!hsd.isPathInUserDir(rp) ||
hsd.isPathInExclude(rp) ||
hsd.isPathInICGExclude(rp) ||
hsd.isPathInExtLib(rp) ||
cs.hasICGNo(header_file_name) ) {
return false ;
} }
// If this class needs a default constructor, then the complier will generate one and we can call it. // If this class needs a default constructor, then the complier will generate one and we can call it.
@ -152,7 +167,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
cval.setHasPublicDestructor(true) ; cval.setHasPublicDestructor(true) ;
} }
cval.setFileName(getFileName(ci , rec->getRBraceLoc(), hsd)) ; cval.setFileName(header_file_name) ;
cval.setAbstract(rec->isAbstract()) ; cval.setAbstract(rec->isAbstract()) ;
cval.setName(rec->getNameAsString()) ; cval.setName(rec->getNameAsString()) ;
cval.setPOD(rec->isPOD()) ; cval.setPOD(rec->isPOD()) ;

View File

@ -83,6 +83,7 @@ std::string FieldDescription::get_regex_field(std::string input , const char * e
// global set of all units processed. hopefully saves time from reparsing same units strings over and over // global set of all units processed. hopefully saves time from reparsing same units strings over and over
std::set< std::string > valid_units ; std::set< std::string > valid_units ;
extern llvm::cl::opt< int > debug_level ;
void FieldDescription::parseComment(std::string comment) { void FieldDescription::parseComment(std::string comment) {
std::string ret_str ; std::string ret_str ;
@ -98,7 +99,9 @@ void FieldDescription::parseComment(std::string comment) {
return ; return ;
} }
//std::cout << "comment before " << comment << std::endl ; if ( debug_level >= 5 ) {
std::cout << "comment before " << comment << std::endl ;
}
// remove open comment chars // remove open comment chars
comment = get_regex_field(comment , "^(//|/\\*)(.*)" , 2) ; comment = get_regex_field(comment , "^(//|/\\*)(.*)" , 2) ;

View File

@ -388,6 +388,9 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
return false ; return false ;
} }
} }
// If the record type is in std:: but not one we can process, set the I/O spec to zero and return.
fdes->setIO(0) ;
return false ;
} }
/* Template specialization types will be processed here because the canonical type /* Template specialization types will be processed here because the canonical type

View File

@ -36,11 +36,6 @@ void PrintFileContents10::printIOHeader(std::ofstream & outfile , std::string he
"#define TRICK_IN_IOSRC\n" "#define TRICK_IN_IOSRC\n"
"#include <stdlib.h>\n" "#include <stdlib.h>\n"
"\n" "\n"
"/* Redefine private and protected to public. This gives the io_code\n"
" access to anything following an access spec keyword. Classes without access\n"
" keywords are immune to this attack. Yes, it's evil! */\n"
"//#define private public\n"
"//#define protected public\n\n"
"#include \"trick/MemoryManager.hh\"\n" "#include \"trick/MemoryManager.hh\"\n"
"#include \"trick/attributes.h\"\n" "#include \"trick/attributes.h\"\n"
"#include \"trick/parameter_types.h\"\n" "#include \"trick/parameter_types.h\"\n"