diff --git a/trick_source/codegen/Interface_Code_Gen/BraceMacro.hh b/trick_source/codegen/Interface_Code_Gen/BraceMacro.hh index c533151a..b0c4b1e3 100644 --- a/trick_source/codegen/Interface_Code_Gen/BraceMacro.hh +++ b/trick_source/codegen/Interface_Code_Gen/BraceMacro.hh @@ -7,4 +7,10 @@ #define RBRACELOC getRBraceLoc #endif +#if (LIBCLANG_MAJOR >=8) +#define GETLOCEND getEndLoc +#else +#define GETLOCEND getLocEnd +#endif + #endif diff --git a/trick_source/codegen/Interface_Code_Gen/TranslationUnitVisitor.cpp b/trick_source/codegen/Interface_Code_Gen/TranslationUnitVisitor.cpp index f815301d..788bf6d0 100644 --- a/trick_source/codegen/Interface_Code_Gen/TranslationUnitVisitor.cpp +++ b/trick_source/codegen/Interface_Code_Gen/TranslationUnitVisitor.cpp @@ -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) ; } }