Fix trick_exclude_typename

Closes #985
This commit is contained in:
Derek Bankieris 2020-04-17 14:09:37 -05:00
parent a181e92960
commit 6613669989

View File

@ -196,7 +196,11 @@ bool CommentSaver::hasICGNoComment( std::string file_name ) {
std::set< std::string > CommentSaver::getIgnoreTypes( std::string file_name ) {
std::set< std::string > ignore_types ;
std::string th_str = getTrickHeaderComment(file_name) ;
if ( ! th_str.empty() ) {
if ( th_str.empty() ) {
return ignore_types;
}
int ret ;
regex_t reg_expr ;
regmatch_t pmatch[10] ;
@ -233,9 +237,7 @@ std::set< std::string > CommentSaver::getIgnoreTypes( std::string file_name ) {
regcomp( &reg_expr , "(ICG[ _]IGNORE[ _]TYPE(S)?:)" , REG_EXTENDED | REG_ICASE ) ;
ret = regexec( &reg_expr , th_str.c_str() , 10 , pmatch , 0 ) ;
regfree(&reg_expr) ;
if ( ret != 0 ) {
return std::set< std::string >() ;
}
if ( !ret ) {
th_str = th_str.substr(pmatch[1].rm_eo) ;
/* find the end of the ICG_IGNORE_TYPES field */
@ -243,9 +245,7 @@ std::set< std::string > CommentSaver::getIgnoreTypes( std::string file_name ) {
regcomp( &reg_expr , "(\\)\\s*\\))" , REG_EXTENDED ) ;
ret = regexec( &reg_expr , th_str.c_str() , 10 , pmatch , 0 ) ;
regfree(&reg_expr) ;
if ( ret != 0 ) {
return std::set< std::string >() ;
}
if ( !ret ) {
th_str = th_str.substr(0 , pmatch[1].rm_so) ;
std::replace( th_str.begin(), th_str.end(), '(', ' ');
std::replace( th_str.begin(), th_str.end(), ')', ' ');
@ -259,7 +259,7 @@ std::set< std::string > CommentSaver::getIgnoreTypes( std::string file_name ) {
ignore_types.insert(item) ;
}
}
}
}
return ignore_types ;