various static analyser bug fixes

This commit is contained in:
Scott Fennell
2018-09-26 14:27:03 -05:00
parent 53f3b308f5
commit a9f84d1d9f
3 changed files with 9 additions and 4 deletions

View File

@ -64,16 +64,19 @@ bool isInUserOrTrickCode( clang::CompilerInstance & ci , clang::SourceLocation s
std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) {
clang::FileID fid = ci.getSourceManager().getFileID(sl) ;
std::string file_name;
char* resolved_path;
if ( ! fid.isInvalid() ) {
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
if ( fe != NULL ) {
char * resolved_path = almostRealPath( fe->getName() ) ;
if ( resolved_path != NULL and hsd.isPathInUserDir(resolved_path)) {
return std::string(resolved_path) ;
file_name.append(resolved_path);
}
free(resolved_path);
}
}
return std::string() ;
return file_name;
}
#include <iostream>