ICG does not compile with LLVM 8.0 #747

getLocEnd got changed to getEndLoc.  Made a LLVM version based macro
to handle both.
This commit is contained in:
Alex Lin 2019-03-26 17:03:11 -05:00
parent a2cee328d2
commit b29a117902
2 changed files with 10 additions and 4 deletions

View File

@ -7,4 +7,10 @@
#define RBRACELOC getRBraceLoc
#endif
#if (LIBCLANG_MAJOR >=8)
#define GETLOCEND getEndLoc
#else
#define GETLOCEND getLocEnd
#endif
#endif

View File

@ -68,7 +68,7 @@ bool TranslationUnitVisitor::TraverseDecl(clang::Decl *d) {
typedef struct Astruct {} Bstruct ;
*/
std::set< std::string >::iterator it ;
std::string file_name = getFileName(ci , d->getLocEnd(), hsd) ;
std::string file_name = getFileName(ci , d->GETLOCEND(), hsd) ;
std::string source_type = cvis.get_class_data()->getName() ;
it = fwd_declared_classes[file_name].find(source_type) ;
if ( it != fwd_declared_classes[file_name].end() ) {
@ -79,7 +79,7 @@ bool TranslationUnitVisitor::TraverseDecl(clang::Decl *d) {
} else {
// These are forward declarations. Insert this into the set of fwd declares keyed by the current file.
if ( ! crd->getNameAsString().empty() ) {
fwd_declared_classes[getFileName(ci , d->getLocEnd(), hsd)].insert(crd->getNameAsString()) ;
fwd_declared_classes[getFileName(ci , d->GETLOCEND(), hsd)].insert(crd->getNameAsString()) ;
}
}
}
@ -116,14 +116,14 @@ bool TranslationUnitVisitor::TraverseDecl(clang::Decl *d) {
case clang::Decl::Typedef : {
clang::TypedefDecl * td = static_cast<clang::TypedefDecl *>(d) ;
if ( isInUserCode(ci, td->getSourceRange().getBegin(), hsd) ) {
TypedefVisitor tv(ci , cs, hsd, pa, fwd_declared_classes[getFileName(ci , d->getLocEnd(), hsd)]) ;
TypedefVisitor tv(ci , cs, hsd, pa, fwd_declared_classes[getFileName(ci , d->GETLOCEND(), hsd)]) ;
tv.TraverseDecl(d) ;
}
}
break ;
case clang::Decl::Var : {
if ( isInUserCode(ci, d->getSourceRange().getBegin(), hsd) ) {
VariableVisitor tv(ci , cs, hsd, pa, fwd_declared_classes[getFileName(ci , d->getLocEnd(), hsd)]) ;
VariableVisitor tv(ci , cs, hsd, pa, fwd_declared_classes[getFileName(ci , d->GETLOCEND(), hsd)]) ;
tv.TraverseDecl(d) ;
}
}