Removed obsolete function from checkNullPointer
This commit is contained in:
parent
e7754be316
commit
5483c8ed5e
|
@ -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()
|
void CheckNullPointer::nullPointerLinkedList()
|
||||||
{
|
{
|
||||||
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
|
@ -139,12 +139,6 @@ private:
|
||||||
* @brief Removes any variable that may be assigned from pointerArgs.
|
* @brief Removes any variable that may be assigned from pointerArgs.
|
||||||
*/
|
*/
|
||||||
static void removeAssignedVarFromSet(const Token* tok, std::set<unsigned int>& 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);
|
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue