mirror of
https://github.com/nasa/trick.git
synced 2025-06-23 09:15:29 +00:00
tool for detecting mismatch between friend init_attr and containing class #371
Added a check and warning message in ICG that warns you if a friend function starts with "init_attr" but does not match the current class name.
This commit is contained in:
@ -310,6 +310,11 @@ bool CXXRecordVisitor::VisitFriendDecl( clang::FriendDecl *fd ) {
|
|||||||
if ( ! friend_str.find(init_func) ) {
|
if ( ! friend_str.find(init_func) ) {
|
||||||
//std::cout << " [32mfound a friend![00m" << std::endl ;
|
//std::cout << " [32mfound a friend![00m" << std::endl ;
|
||||||
cval.setHasInitAttrFriend(true) ;
|
cval.setHasInitAttrFriend(true) ;
|
||||||
|
} else if ( ! friend_str.find("init_attr") ) {
|
||||||
|
std::cerr << bold(color(WARNING,"Warning")) << " " << cval.getFileName() << ":" <<
|
||||||
|
ci.getSourceManager().getSpellingLineNumber(fd->getSourceRange().getBegin()) << ":" << std::endl ;
|
||||||
|
std::cerr << " friend " << friend_str << " does not match expected name " <<
|
||||||
|
init_func << std::endl ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user