Symbolic links are my nemesis

Found 2 more places where we should be using the absolute path.

refs #240
This commit is contained in:
Alex Lin 2016-05-24 13:30:56 -05:00
parent 15f677ec48
commit 9d840f334f
4 changed files with 30 additions and 9 deletions

View File

@ -261,8 +261,9 @@ sub parse_s_define ($) {
} else {
my $found = 0 ;
foreach my $inc_path ( @valid_inc_paths ) {
if ( -f "$inc_path/$object_file" ) {
push @{$$sim_ref{mis_entry_files}}, "$inc_path/$object_file" ;
my $f = abs_path(dirname("$inc_path/$object_file")) . "/" . basename("$inc_path/$object_file") ;
if ( -f "$f" ) {
push @{$$sim_ref{mis_entry_files}}, "$f" ;
$found = 1 ;
last ;
}

View File

@ -134,6 +134,11 @@ void CommentSaver::getICGField( std::string file_name ) {
}
bool CommentSaver::hasTrickHeader( std::string file_name ) {
std::string th_str = getTrickHeaderComment(file_name) ;
return (! th_str.empty()) ;
}
bool CommentSaver::hasICGNo( std::string file_name ) {
if ( icg_no_found.find(file_name) == icg_no_found.end() ) {

View File

@ -58,6 +58,12 @@ class CommentSaver : public clang::CommentHandler {
*/
void getICGField( std::string file_name ) ;
/** Returns if the header has a Trick header comment
@param file_name = File name to search
@return true = if header comment found
*/
bool hasTrickHeader(std::string file_name ) ;
/** Searches the Trick header comment for the ICG:(No) entry.
@param file_name = File name to search
@return true = ICG:(No) was found.

View File

@ -144,20 +144,29 @@ bool FieldVisitor::VisitDeclaratorDecl( clang::DeclaratorDecl *dd ) {
fdes->setName(dd->getNameAsString()) ;
fdes->setAccess(dd->getAccess()) ;
/* Get the source location of this field. */
/* Get the source location of this field.*/
clang::SourceRange dd_range = dd->getSourceRange() ;
std::string file_name = ci.getSourceManager().getBufferName(dd_range.getEnd()) ;
char * resolved_path = almostRealPath( file_name.c_str() ) ;
if ( resolved_path ) {
if ( ! ci.getSourceManager().isInSystemHeader(dd_range.getEnd()) ) {
clang::PresumedLoc PLoc = ci.getSourceManager().getPresumedLoc(dd_range.getEnd());
std::string file_name ;
if (!PLoc.isInvalid()) {
char * resolved_path = almostRealPath(PLoc.getFilename()) ;
if ( resolved_path != NULL ) {
file_name = std::string(resolved_path) ;
free(resolved_path) ;
}
}
if ( ! file_name.empty() ) {
if ( isInUserOrTrickCode( ci , dd_range.getEnd() , hsd ) ) {
fdes->setLineNo(ci.getSourceManager().getSpellingLineNumber(dd_range.getEnd())) ;
/* process comment if neither ICG:(No) or ICG:(NoComment) is present */
if ( ! cs.hasICGNoComment(file_name) and ! hsd.isPathInICGNoComment(file_name) ) {
if ( cs.hasTrickHeader(file_name) and
!cs.hasICGNoComment(file_name) and
!hsd.isPathInICGNoComment(file_name) ) {
/* Get the possible comment on this line and parse it */
fdes->parseComment(cs.getComment(file_name , fdes->getLineNo())) ;
}
}
free(resolved_path) ;
}
if ( debug_level >= 3 ) {