mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
issue 1065 llvm 11 support (#1066)
* # 1065 all LLVM::StrRefs need to use str() to convert to std::string now * #1065 retain backwards compatibility for llvm 3.4.2 (RHEL 7) closes #1065 Co-authored-by: Scott Fennell <sfennell@Scotts-MacBook-Pro.local>
This commit is contained in:
parent
da4888a1b7
commit
6618d09c15
@ -15,7 +15,11 @@ bool CommentSaver::HandleComment(clang::Preprocessor &PP, clang::SourceRange Com
|
||||
|
||||
//Comment.getBegin().dump(sm) ;
|
||||
if ( isInUserOrTrickCode( ci , Comment.getBegin() , hsd ) ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
std::string file_name = ci.getSourceManager().getBufferName(Comment.getBegin()) ;
|
||||
#else
|
||||
std::string file_name = ci.getSourceManager().getBufferName(Comment.getBegin()).str() ;
|
||||
#endif
|
||||
char * resolved_path = almostRealPath( file_name.c_str() ) ;
|
||||
if ( resolved_path != NULL ) {
|
||||
unsigned int line_no = ci.getSourceManager().getSpellingLineNumber(Comment.getBegin()) ;
|
||||
|
@ -228,7 +228,8 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) {
|
||||
std::cout << "FieldVisitor VisitFieldDecl" << std::endl ;
|
||||
std::cout << " is_bitfield = " << fdes->isBitField() << std::endl ;
|
||||
std::cout << " is_canonical = " << qt.isCanonical() << std::endl ;
|
||||
std::cout << " is_hidden = " << field->isHidden() << std::endl ;
|
||||
// isHidden() removed in clang 11.0
|
||||
//std::cout << " is_hidden = " << field->isHidden() << std::endl ;
|
||||
//field->dump() ;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,11 @@ bool HeaderSearchDirs::isPathInUserDir (const std::string& in_dir ) {
|
||||
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
std::string curr_dir = (*sdi).getName() ;
|
||||
#else
|
||||
std::string curr_dir = (*sdi).getName().str() ;
|
||||
#endif
|
||||
if ( ! in_dir.compare(0, curr_dir.size(), curr_dir)) {
|
||||
return false ;
|
||||
}
|
||||
@ -244,7 +248,11 @@ bool HeaderSearchDirs::isPathInUserOrTrickDir (const std::string& in_dir ) {
|
||||
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
std::string curr_dir = (*sdi).getName() ;
|
||||
#else
|
||||
std::string curr_dir = (*sdi).getName().str() ;
|
||||
#endif
|
||||
if ( ! in_dir.compare(0, curr_dir.size(), curr_dir)) {
|
||||
return false ;
|
||||
}
|
||||
|
@ -393,7 +393,11 @@ std::set<std::string> PrintAttributes::getEmptyFiles() {
|
||||
std::set<std::string> emptyFiles;
|
||||
for (auto fi = ci.getSourceManager().fileinfo_begin() ; fi != ci.getSourceManager().fileinfo_end() ; ++fi ) {
|
||||
const clang::FileEntry * fe = (*fi).first ;
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
std::string header_file_name = fe->getName() ;
|
||||
#else
|
||||
std::string header_file_name = fe->getName().str() ;
|
||||
#endif
|
||||
|
||||
if ( visited_files.find(header_file_name) != visited_files.end() ) {
|
||||
continue;
|
||||
|
@ -66,7 +66,11 @@ bool isInUserCode( clang::CompilerInstance & ci , clang::SourceLocation sl , Hea
|
||||
if ( ! fid.isInvalid() ) {
|
||||
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
|
||||
if ( fe != NULL ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
char * resolved_path = almostRealPath( fe->getName() ) ;
|
||||
#else
|
||||
char * resolved_path = almostRealPath( fe->getName().str() ) ;
|
||||
#endif
|
||||
if ( resolved_path != NULL ) {
|
||||
if ( hsd.isPathInUserDir(resolved_path)) {
|
||||
ret = true ;
|
||||
@ -84,7 +88,11 @@ bool isInUserOrTrickCode( clang::CompilerInstance & ci , clang::SourceLocation s
|
||||
if ( ! fid.isInvalid() ) {
|
||||
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
|
||||
if ( fe != NULL ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
char * resolved_path = almostRealPath( fe->getName() ) ;
|
||||
#else
|
||||
char * resolved_path = almostRealPath( fe->getName().str() ) ;
|
||||
#endif
|
||||
if ( resolved_path != NULL ) {
|
||||
if ( hsd.isPathInUserOrTrickDir(resolved_path)) {
|
||||
ret = true ;
|
||||
@ -103,7 +111,11 @@ std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl
|
||||
if ( ! fid.isInvalid() ) {
|
||||
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
|
||||
if ( fe != NULL ) {
|
||||
#if (LIBCLANG_MAJOR < 4) // TODO delete when RHEL 7 no longer supported
|
||||
char * resolved_path = almostRealPath( fe->getName() ) ;
|
||||
#else
|
||||
char * resolved_path = almostRealPath( fe->getName().str() ) ;
|
||||
#endif
|
||||
if ( resolved_path != NULL and hsd.isPathInUserDir(resolved_path)) {
|
||||
file_name.append(resolved_path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user