ICG does not compile using llvm 3.9 #339

The call getRBraceLoc to find the ending source location of things is gone.  Replaced
it with getting the source range and get the end of that range.  Also the way to
get clang/llvm 3.9 to process c++11 code required some reordering of calls in main as
well as adding some more features to be turned on.
This commit is contained in:
Alex Lin
2016-10-28 13:21:21 -05:00
parent e66fc2bbd5
commit ba75f6ff37
6 changed files with 99 additions and 80 deletions

View File

@ -56,7 +56,7 @@ bool CXXRecordVisitor::TraverseDecl(clang::Decl *d) {
clang::RecordDecl * rd = crd->getDefinition() ;
if ( rd != NULL ) {
if ( rd->getAccess() == clang::AS_public ) {
if ( isInUserCode(ci , crd->getRBraceLoc(), hsd) ) {
if ( isInUserCode(ci , crd->getSourceRange().getEnd(), hsd) ) {
CXXRecordVisitor embedded_cvis(ci , cs, hsd , pa, true) ;
embedded_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(d)) ;
pa.printClass(embedded_cvis.get_class_data()) ;
@ -149,7 +149,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
}
// 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) ;
std::string header_file_name = getFileName(ci , rec->getSourceRange().getEnd(), hsd) ;
char * rp = almostRealPath(header_file_name.c_str()) ;
if ( rp == NULL ||
!hsd.isPathInUserDir(rp) ||
@ -200,13 +200,13 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
clang::RecordDecl * rd = rt->getDecl() ;
//std::cout << " " << cval.getName() << " inherits from " << rd->getNameAsString() << "" << std::endl ;
//rd->dump() ; std::cout << std::endl ;
if ( isInUserOrTrickCode(ci , rd->getRBraceLoc(), hsd) ) {
if ( isInUserOrTrickCode(ci , rd->getSourceRange().getEnd(), hsd) ) {
const clang::ASTRecordLayout &record_layout = rec->getASTContext().getASTRecordLayout(rec);
unsigned int inherit_class_offset ;
inherit_class_offset = record_layout.getBaseClassOffset(llvm::cast<clang::CXXRecordDecl>(rd)).getQuantity() ;
//std::cout << " inherit_class_offset = " << inherit_class_offset << "" << std::endl ;
//std::cout << " " << getFileName(ci , rd->getRBraceLoc(), hsd) << "" << std::endl ;
//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(),
@ -248,7 +248,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
//std::cout << " " << cval.getName() << " virtually inherits from "
// << rd->getNameAsString() << "" << std::endl ;
//rd->dump() ; std::cout << std::endl ;
if ( isInUserOrTrickCode(ci , rd->getRBraceLoc(), hsd) ) {
if ( isInUserOrTrickCode(ci , rd->getSourceRange().getEnd(), hsd) ) {
const clang::ASTRecordLayout &record_layout = rec->getASTContext().getASTRecordLayout(rec);
unsigned int inherit_class_offset ;
@ -257,7 +257,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
inherit_class_offset = record_layout.getVBaseClassOffset(llvm::cast<clang::CXXRecordDecl>(rd)).getQuantity() ;
//std::cout << " inherit_class_offset = " << inherit_class_offset << "" << std::endl ;
//std::cout << " " << getFileName(ci , rd->getRBraceLoc(), hsd) << "" << std::endl ;
//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) ;