Library: Renamed Argument to ArgumentChecks to make it a bit more clear

This commit is contained in:
Daniel Marjamäki 2013-07-16 09:40:31 +02:00
parent 548234ba50
commit fa7f8ddc78
3 changed files with 23 additions and 23 deletions

View File

@ -36,7 +36,7 @@ Library::Library() : allocid(0)
Library::Library(const Library &lib) :
use(lib.use),
ignore(lib.ignore),
functionArgument(lib.functionArgument),
argumentChecks(lib.argumentChecks),
returnuninitdata(lib.returnuninitdata),
allocid(lib.allocid),
_alloc(lib._alloc),
@ -101,8 +101,8 @@ bool Library::load(const char path[])
else
return false;
}
functionArgument[name][nr].notnull = notnull;
functionArgument[name][nr].notuninit = notuninit;
argumentChecks[name][nr].notnull = notnull;
argumentChecks[name][nr].notuninit = notuninit;
} else
return false;
}

View File

@ -71,21 +71,21 @@ public:
return (it != _noreturn.end() && !it->second);
}
struct Argument {
struct ArgumentChecks {
bool notnull;
bool notuninit;
};
// function name, argument nr => argument data
std::map<std::string, std::map<int, Argument> > functionArgument;
std::map<std::string, std::map<int, ArgumentChecks> > argumentChecks;
bool isnullargbad(const std::string &functionName, int argnr) const {
const Argument *arg = getarg(functionName,argnr);
const ArgumentChecks *arg = getarg(functionName,argnr);
return arg && arg->notnull;
}
bool isuninitargbad(const std::string &functionName, int argnr) const {
const Argument *arg = getarg(functionName,argnr);
const ArgumentChecks *arg = getarg(functionName,argnr);
return arg && arg->notuninit;
}
@ -97,11 +97,11 @@ private:
std::map<std::string, int> _dealloc; // deallocation functions
std::map<std::string, bool> _noreturn; // is function noreturn?
const Argument * getarg(const std::string &functionName, int argnr) const {
std::map<std::string, std::map<int, Argument> >::const_iterator it1;
it1 = functionArgument.find(functionName);
if (it1 != functionArgument.end()) {
const std::map<int,Argument>::const_iterator it2 = it1->second.find(argnr);
const ArgumentChecks * getarg(const std::string &functionName, int argnr) const {
std::map<std::string, std::map<int, ArgumentChecks> >::const_iterator it1;
it1 = argumentChecks.find(functionName);
if (it1 != argumentChecks.end()) {
const std::map<int,ArgumentChecks>::const_iterator it2 = it1->second.find(argnr);
if (it2 != it1->second.end())
return &it2->second;
}

View File

@ -2116,9 +2116,9 @@ private:
// nothing bad..
{
Library library;
Library::Argument arg = {false, false};
library.functionArgument["x"][1] = arg;
library.functionArgument["x"][2] = arg;
Library::ArgumentChecks arg = {false, false};
library.argumentChecks["x"][1] = arg;
library.argumentChecks["x"][2] = arg;
std::list<const Token *> null, uninit;
CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U);
@ -2130,10 +2130,10 @@ private:
// for 1st parameter null pointer is not ok..
{
Library library;
struct Library::Argument arg = {false, false};
library.functionArgument["x"][1] = arg;
library.functionArgument["x"][2] = arg;
library.functionArgument["x"][1].notnull = true;
struct Library::ArgumentChecks arg = {false, false};
library.argumentChecks["x"][1] = arg;
library.argumentChecks["x"][2] = arg;
library.argumentChecks["x"][1].notnull = true;
std::list<const Token *> null,uninit;
CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U);
@ -2146,10 +2146,10 @@ private:
// for 2nd parameter uninit data is not ok..
{
Library library;
Library::Argument arg = {false, false};
library.functionArgument["x"][1] = arg;
library.functionArgument["x"][2] = arg;
library.functionArgument["x"][2].notuninit = true;
Library::ArgumentChecks arg = {false, false};
library.argumentChecks["x"][1] = arg;
library.argumentChecks["x"][2] = arg;
library.argumentChecks["x"][2].notuninit = true;
std::list<const Token *> null,uninit;
CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U);