mirror of
https://github.com/nasa/trick.git
synced 2025-01-18 10:46:26 +00:00
various static analyser bug fixes
This commit is contained in:
parent
53f3b308f5
commit
a9f84d1d9f
@ -64,16 +64,19 @@ bool isInUserOrTrickCode( clang::CompilerInstance & ci , clang::SourceLocation s
|
|||||||
|
|
||||||
std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) {
|
std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) {
|
||||||
clang::FileID fid = ci.getSourceManager().getFileID(sl) ;
|
clang::FileID fid = ci.getSourceManager().getFileID(sl) ;
|
||||||
|
std::string file_name;
|
||||||
|
char* resolved_path;
|
||||||
if ( ! fid.isInvalid() ) {
|
if ( ! fid.isInvalid() ) {
|
||||||
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
|
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
|
||||||
if ( fe != NULL ) {
|
if ( fe != NULL ) {
|
||||||
char * resolved_path = almostRealPath( fe->getName() ) ;
|
char * resolved_path = almostRealPath( fe->getName() ) ;
|
||||||
if ( resolved_path != NULL and hsd.isPathInUserDir(resolved_path)) {
|
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>
|
#include <iostream>
|
||||||
|
@ -315,6 +315,7 @@ RK2MidpointGeneralizedStepSecondOrderODEIntegrator::integrate (
|
|||||||
step_factor = 1.0;
|
step_factor = 1.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
step_factor = 1.0;
|
step_factor = 1.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,15 @@ void DeleteTblEntry(TBLENTRY * entry)
|
|||||||
/* create an iterator */
|
/* create an iterator */
|
||||||
StrMapIterator *SMI_Create(MapStrToPtr * pTable)
|
StrMapIterator *SMI_Create(MapStrToPtr * pTable)
|
||||||
{
|
{
|
||||||
StrMapIterator *pIter = (StrMapIterator *) malloc(sizeof(StrMapIterator));
|
StrMapIterator *pIter;
|
||||||
|
|
||||||
|
|
||||||
if (pTable == NULL) {
|
if (pTable == NULL) {
|
||||||
fprintf(stderr, "Table is NULL");
|
fprintf(stderr, "Table is NULL");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pIter = (StrMapIterator *) malloc(sizeof(StrMapIterator));
|
||||||
|
|
||||||
pIter->m_pTable = pTable;
|
pIter->m_pTable = pTable;
|
||||||
pIter->m_Index = 0; /* set the current index of the list array to 0 */
|
pIter->m_Index = 0; /* set the current index of the list array to 0 */
|
||||||
pIter->m_ListPos = NULL; /* set the position reference to null indicating there is not a current element */
|
pIter->m_ListPos = NULL; /* set the position reference to null indicating there is not a current element */
|
||||||
|
Loading…
Reference in New Issue
Block a user