Removed obsolete function from checkNullPointer

This commit is contained in:
PKEuS 2014-08-18 11:42:50 +02:00
parent e7754be316
commit 5483c8ed5e
2 changed files with 0 additions and 39 deletions

View File

@ -225,39 +225,6 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown)
}
// check if function can assign pointer
bool CheckNullPointer::CanFunctionAssignPointer(const Token *functiontoken, unsigned int varid, bool& unknown)
{
if (Token::Match(functiontoken, "if|while|for|switch|sizeof|catch"))
return false;
unsigned int argumentNumber = 0;
for (const Token *arg = functiontoken->tokAt(2); arg; arg = arg->nextArgument()) {
if (Token::Match(arg, "%varid% [,)]", varid)) {
const Function* func = functiontoken->function();
if (!func) { // Unknown function
unknown = true;
return true; // assume that the function might assign the pointer
}
const Variable* var = func->getArgumentVar(argumentNumber);
if (!var) { // Unknown variable
unknown = true;
return true;
} else if (var->isReference()) // Assume every pointer passed by reference is assigned
return true;
else
return false;
}
++argumentNumber;
}
// pointer is not passed
return false;
}
void CheckNullPointer::nullPointerLinkedList()
{
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();

View File

@ -139,12 +139,6 @@ private:
* @brief Removes any variable that may be assigned from pointerArgs.
*/
static void removeAssignedVarFromSet(const Token* tok, std::set<unsigned int>& pointerArgs);
/**
* @brief Investigate if function call can make pointer null. If
* the pointer is passed by value it can't be made a null pointer.
*/
static bool CanFunctionAssignPointer(const Token *functiontoken, unsigned int varid, bool& unknown);
};
/// @}
//---------------------------------------------------------------------------