mirror of
https://github.com/nasa/trick.git
synced 2025-06-18 23:28:26 +00:00
Pre-increment (rather than post-increment) STL iterators in for loops… (#1692)
* Pre-increment (rather than post-increment) STL iterators in for loops. #1594 * Fix a goof. #1594
This commit is contained in:
@ -22,7 +22,7 @@ ClassValues::ClassValues() :
|
||||
|
||||
ClassValues::~ClassValues() {
|
||||
std::vector<FieldDescription *>::iterator fdit ;
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; fdit++ ) {
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; ++fdit ) {
|
||||
delete (*fdit) ;
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
|
||||
std::vector<FieldDescription *>::iterator fdit ;
|
||||
// Loop through the incoming inherited variable names
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; ++fdit ) {
|
||||
|
||||
(*fdit)->setBaseClassOffset( class_offset ) ;
|
||||
(*fdit)->setInherited( true ) ;
|
||||
@ -72,7 +72,7 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; ++fdit ) {
|
||||
|
||||
std::string in_name = (*fdit)->getName() ;
|
||||
// search existing names for incoming inherited variable name.
|
||||
@ -113,7 +113,7 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
void ClassValues::saveInheritAncestry( ClassValues * in_cv ) {
|
||||
|
||||
std::map< std::string , unsigned int >::iterator mit ;
|
||||
for ( mit = in_cv->all_inherited_class_names_map.begin() ; mit != in_cv->all_inherited_class_names_map.end() ; mit++ ) {
|
||||
for ( mit = in_cv->all_inherited_class_names_map.begin() ; mit != in_cv->all_inherited_class_names_map.end() ; ++mit ) {
|
||||
all_inherited_class_names_map[(*mit).first] += (*mit).second ;
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ void ClassValues::saveInheritAncestry( ClassValues * in_cv ) {
|
||||
void ClassValues::setContainerClassForFields() {
|
||||
std::vector<FieldDescription *>::iterator fdit ;
|
||||
// Loop through all fields
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; fdit++ ) {
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; ++fdit ) {
|
||||
// Prepend the field container class with the current class name.
|
||||
(*fdit)->setContainerClass( name + "::" + (*fdit)->getContainerClass() ) ;
|
||||
}
|
||||
@ -134,13 +134,13 @@ void ClassValues::clearAmbiguousVariables() {
|
||||
std::map< std::string , unsigned int >::iterator mit ;
|
||||
std::vector<FieldDescription *>::iterator fdit ;
|
||||
|
||||
for ( mit = all_inherited_class_names_map.begin() ; mit != all_inherited_class_names_map.end() ; mit++ ) {
|
||||
for ( mit = all_inherited_class_names_map.begin() ; mit != all_inherited_class_names_map.end() ; ++mit ) {
|
||||
// If a class in inherited more than once we have a diamond. We'll need to modify variables that were
|
||||
// inherited from that class.
|
||||
if ( (*mit).second > 1 ) {
|
||||
std::string str = (*mit).first + "::" ;
|
||||
// Loop through all fields testing for the diamond inherited class in the name.
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; fdit++ ) {
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; ++fdit ) {
|
||||
std::string fdit_name = (*fdit)->getName() ;
|
||||
size_t f = fdit_name.find(str) ;
|
||||
// If the variable contains the diamond class string, remove the diamond class qualification.
|
||||
|
@ -210,7 +210,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
} else {
|
||||
// Test all constructors to see if any of those are the default and public
|
||||
clang::CXXRecordDecl::ctor_iterator cit ;
|
||||
for ( cit = rec->ctor_begin() ; cit != rec->ctor_end() ; cit++ ) {
|
||||
for ( cit = rec->ctor_begin() ; cit != rec->ctor_end() ; ++cit ) {
|
||||
if ( ( !(*cit)->isDeleted() ) and (*cit)->isDefaultConstructor() and (*cit)->getAccess() == clang::AS_public ) {
|
||||
cval.setHasDefaultConstructor(true) ;
|
||||
}
|
||||
@ -234,7 +234,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
//std::cout << "parsing " << cval.getName() << std::endl ;
|
||||
//std::cout << " [34mprocessing inheritance " << rec->getNumBases() << " " << rec->getNumVBases() << "[00m" << std::endl ;
|
||||
clang::CXXRecordDecl::base_class_iterator bcii ;
|
||||
for ( bcii = rec->bases_begin() ; bcii != rec->bases_end() ; bcii++ ) {
|
||||
for ( bcii = rec->bases_begin() ; bcii != rec->bases_end() ; ++bcii ) {
|
||||
if ( !bcii->isVirtual() ) {
|
||||
const clang::Type * temp = bcii->getType().getTypePtr() ;
|
||||
//std::cout << "\n[33minherited Type = " << temp->getTypeClassName() << "[00m" << std::endl ;
|
||||
@ -282,7 +282,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
// When processing inherited classes include_virtual_base will be set to true
|
||||
// so we don't process virtual inherited classes multiple times.
|
||||
if ( include_virtual_base ) {
|
||||
for ( bcii = rec->vbases_begin() ; bcii != rec->vbases_end() ; bcii++ ) {
|
||||
for ( bcii = rec->vbases_begin() ; bcii != rec->vbases_end() ; ++bcii ) {
|
||||
const clang::Type * temp = bcii->getType().getTypePtr() ;
|
||||
//std::cout << "\n[33minherited Type = " << temp->getTypeClassName() << "[00m" << std::endl ;
|
||||
const clang::RecordType * rt = temp->getAs<clang::RecordType>() ;
|
||||
|
@ -60,7 +60,7 @@ std::string CommentSaver::getTrickHeaderComment( std::string file_name ) {
|
||||
if ( resolved_path != NULL ) {
|
||||
if ( trick_header_comments.find(resolved_path) == trick_header_comments.end() ) {
|
||||
trick_header_comments[resolved_path] = std::string() ;
|
||||
for ( cit = comment_map[resolved_path].begin() ; cit != comment_map[resolved_path].end() ; cit++ ) {
|
||||
for ( cit = comment_map[resolved_path].begin() ; cit != comment_map[resolved_path].end() ; ++cit ) {
|
||||
std::string comment_str = getComment((*cit).second) ;
|
||||
if ( comment_str.find("@trick_parse") != std::string::npos or
|
||||
comment_str.find("\\trick_parse") != std::string::npos ) {
|
||||
|
@ -304,7 +304,7 @@ void FieldDescription::parseComment(std::string comment) {
|
||||
// escape special characters, convert tabs and newlines to spaces, remove multiple spaces.
|
||||
std::ostringstream ss ;
|
||||
bool is_space = false ;
|
||||
for (std::string::iterator it = comment.begin(); it != comment.end(); it++) {
|
||||
for (std::string::iterator it = comment.begin(); it != comment.end(); ++it) {
|
||||
switch (*it) {
|
||||
case '\\': ss << "\\\\"; is_space = false ; break;
|
||||
case '"': ss << "\\\""; is_space = false ; break;
|
||||
|
@ -442,7 +442,7 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
|
||||
// Test if we have some type from STL.
|
||||
if (!tst_string.compare( 0 , 5 , "std::")) {
|
||||
// If we have some type from std, figure out if it is one we support.
|
||||
for ( std::map<std::string, bool>::iterator it = stl_classes.begin() ; it != stl_classes.end() ; it++ ) {
|
||||
for ( std::map<std::string, bool>::iterator it = stl_classes.begin() ; it != stl_classes.end() ; ++it ) {
|
||||
/* Mark STL types that are not strings and exit */
|
||||
if (!tst_string.compare( 0 , (*it).first.size() , (*it).first)) {
|
||||
|
||||
|
@ -80,7 +80,7 @@ void FindTrickICG::If(clang::SourceLocation Loc, clang::SourceRange ConditionRan
|
||||
if ( ref.str().find("TRICK_ICG") != std::string::npos ) {
|
||||
// for each header in the stack, mark them as being exposed to TRICK_ICG
|
||||
std::vector<std::string>::iterator it ;
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; it++ ) {
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; ++it ) {
|
||||
hsd.addTrickICGFoundFile(*it) ;
|
||||
}
|
||||
// print warning messages.
|
||||
@ -124,7 +124,7 @@ void FindTrickICG::Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNam
|
||||
if ( (loc_str.find("S_source.hh") == std::string::npos) ) {
|
||||
// for each header in the stack, mark them as being exposed to TRICK_ICG
|
||||
std::vector<std::string>::iterator it ;
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; it++ ) {
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; ++it ) {
|
||||
hsd.addTrickICGFoundFile(*it) ;
|
||||
}
|
||||
// print warning messages.
|
||||
@ -149,7 +149,7 @@ void FindTrickICG::Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNa
|
||||
std::string loc_str = Loc.printToString(ci.getSourceManager()) ;
|
||||
// for each header in the stack, mark them as being exposed to TRICK_ICG
|
||||
std::vector<std::string>::iterator it ;
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; it++ ) {
|
||||
for ( it = included_files.begin() ; it != included_files.end() ; ++it ) {
|
||||
hsd.addTrickICGFoundFile(*it) ;
|
||||
}
|
||||
// print warning messages.
|
||||
|
@ -186,13 +186,13 @@ void HeaderSearchDirs::ApplyHeaderSearchOptions () {
|
||||
clang::ApplyHeaderSearchOptions( hs , hso , pp.getLangOpts() , pp.getTargetInfo().getTriple() ) ;
|
||||
//clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
/*
|
||||
for ( sdi = hs.quoted_dir_begin() ; sdi != hs.quoted_dir_end() ; sdi++ ) {
|
||||
for ( sdi = hs.quoted_dir_begin() ; sdi != hs.quoted_dir_end() ; ++sdi ) {
|
||||
std::cout << "quoted dir " << (*sdi).getName() << std::endl ;
|
||||
}
|
||||
for ( sdi = hs.angled_dir_begin() ; sdi != hs.angled_dir_end() ; sdi++ ) {
|
||||
for ( sdi = hs.angled_dir_begin() ; sdi != hs.angled_dir_end() ; ++sdi ) {
|
||||
std::cout << "angled dir " << (*sdi).getName() << std::endl ;
|
||||
}
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ ) {
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; ++sdi ) {
|
||||
std::cout << "system dir " << (*sdi).getName() << std::endl ;
|
||||
}
|
||||
*/
|
||||
@ -229,7 +229,7 @@ bool HeaderSearchDirs::isPathInUserDir (const std::string& in_dir ) {
|
||||
for ( clang::ConstSearchDirIterator sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi = std::next(sdi) )
|
||||
#else
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ )
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; ++sdi )
|
||||
#endif
|
||||
{
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
@ -261,7 +261,7 @@ bool HeaderSearchDirs::isPathInUserOrTrickDir (const std::string& in_dir ) {
|
||||
for ( clang::ConstSearchDirIterator sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi = std::next(sdi) )
|
||||
#else
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ )
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; ++sdi )
|
||||
#endif
|
||||
{
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
@ -279,7 +279,7 @@ bool HeaderSearchDirs::isPathInUserOrTrickDir (const std::string& in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return true ;
|
||||
}
|
||||
@ -291,7 +291,7 @@ bool HeaderSearchDirs::isPathInExclude (const std::string& in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInICGExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; vit++ ) {
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return true ;
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool HeaderSearchDirs::isPathInICGExclude (const std::string& in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInExtLib (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; vit++ ) {
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return true ;
|
||||
}
|
||||
@ -318,7 +318,7 @@ bool HeaderSearchDirs::isPathInICGNoComment (const std::string& in_dir ) {
|
||||
}
|
||||
else {
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = icg_nocomment_dirs.begin() ; vit != icg_nocomment_dirs.end() ; vit++ ) {
|
||||
for ( vit = icg_nocomment_dirs.begin() ; vit != icg_nocomment_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
icg_nocomment_files[in_dir] = true ;
|
||||
return true;
|
||||
@ -332,7 +332,7 @@ bool HeaderSearchDirs::isPathInICGNoComment (const std::string& in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInCompat15 (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = compat15_dirs.begin() ; vit != compat15_dirs.end() ; vit++ ) {
|
||||
for ( vit = compat15_dirs.begin() ; vit != compat15_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return true ;
|
||||
}
|
||||
@ -347,7 +347,7 @@ bool HeaderSearchDirs::isPathInCompat15 (const std::string& in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return (*vit) ;
|
||||
}
|
||||
@ -359,7 +359,7 @@ std::string HeaderSearchDirs::getPathInExclude (const std::string& in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInICGExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; vit++ ) {
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return (*vit) ;
|
||||
}
|
||||
@ -371,7 +371,7 @@ std::string HeaderSearchDirs::getPathInICGExclude (const std::string& in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInExtLib (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; vit++ ) {
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; ++vit ) {
|
||||
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
|
||||
return (*vit) ;
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ void PrintAttributes::printIOMakefile() {
|
||||
<< "IO_OBJECTS =" ;
|
||||
|
||||
std::map< std::string , std::string >::iterator mit ;
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) {
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; ++mit ) {
|
||||
size_t found ;
|
||||
found = (*mit).second.find_last_of(".") ;
|
||||
makefile_io_src << " \\\n " << (*mit).second.substr(0,found) << ".o" ;
|
||||
@ -487,7 +487,7 @@ void PrintAttributes::printIOMakefile() {
|
||||
ICG_processed.open("build/ICG_processed") ;
|
||||
|
||||
makefile_ICG << "build/Makefile_io_src:" ;
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) {
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; ++mit ) {
|
||||
makefile_ICG << " \\\n " << (*mit).first ;
|
||||
size_t found ;
|
||||
found = (*mit).second.find_last_of(".") ;
|
||||
@ -518,7 +518,7 @@ void PrintAttributes::printICGNoFiles() {
|
||||
if ( ! sim_services_flag ) {
|
||||
std::vector< std::string >::iterator it ;
|
||||
std::ofstream icg_no_outfile("build/ICG_no_found") ;
|
||||
for ( it = icg_no_files.begin() ; it != icg_no_files.end() ; it++ ) {
|
||||
for ( it = icg_no_files.begin() ; it != icg_no_files.end() ; ++it ) {
|
||||
icg_no_outfile << (*it) << std::endl ;
|
||||
}
|
||||
icg_no_outfile.close() ;
|
||||
|
Reference in New Issue
Block a user