Refactor ICG

Hey buddy. I wanted to tell you this before you heard it from someone
else...

I refactored ICG.

Now, it's gonna look a little scary at first. But I promise you'll like
it when you get used to it. It'll be fine. You can trust me. #341
This commit is contained in:
Derek Bankieris
2016-10-28 14:37:12 -05:00
parent ba75f6ff37
commit ef1405c3be
22 changed files with 365 additions and 1009 deletions

View File

@ -209,7 +209,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
//std::cout << " " << getFileName(ci , rd->getSourceRange().getEnd(), hsd) << "" << std::endl ;
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, false) ;
inherit_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(rd)) ;
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescription(),
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescriptions(),
inherit_class_offset, false) ;
// clear the field list in the inherited class so they are not freed when inherit_cvis
// goes out of scope.
@ -260,7 +260,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
//std::cout << " " << getFileName(ci , rd->getSourceRange().getEnd(), hsd) << "" << std::endl ;
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, false) ;
inherit_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(rd)) ;
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescription(), inherit_class_offset, true) ;
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescriptions(), inherit_class_offset, true) ;
// clear the field list in the inherited class so they are not freed when inherit_cvis goes out of scope.
inherit_cvis.get_class_data()->clearFieldDescription() ;
// If we are inheriting from a template specialization, don't save the inherited class. This list
@ -300,7 +300,7 @@ bool CXXRecordVisitor::VisitFriendDecl( clang::FriendDecl *fd ) {
//nd->dump() ;
std::string init_func = std::string("init_attr") ;
std::stringstream name_sp ;
cval.print_namespaces( name_sp , "__") ;
cval.printNamespaces( name_sp , "__") ;
init_func += name_sp.str() + cval.getName() ;
std::string friend_str = nd->getName().str() ;
if ( ! friend_str.find(init_func) ) {