Addons: Fixed handling of noname arguments

This commit is contained in:
Daniel Marjamäki 2018-04-10 11:10:10 +02:00
parent d46e4c1df6
commit 1767fe525b
2 changed files with 17 additions and 3 deletions

View File

@ -471,6 +471,7 @@ class Configuration:
self.functions = []
self.variables = []
self.valueflow = []
arguments = []
for element in confignode:
if element.tag == 'directivelist':
@ -497,7 +498,11 @@ class Configuration:
self.functions.append(Function(function))
if element.tag == 'variables':
for variable in element:
self.variables.append(Variable(variable))
var = Variable(variable)
if var.nameToken:
self.variables.append(var)
else:
arguments.append(var)
if element.tag == 'valueflow':
for values in element:
self.valueflow.append(ValueFlow(values))
@ -511,6 +516,8 @@ class Configuration:
IdMap[function.Id] = function
for variable in self.variables:
IdMap[variable.Id] = variable
for variable in arguments:
IdMap[variable.Id] = variable
for values in self.valueflow:
IdMap[values.Id] = values.values
@ -522,6 +529,8 @@ class Configuration:
function.setId(IdMap)
for variable in self.variables:
variable.setId(IdMap)
for variable in arguments:
variable.setId(IdMap)
class Platform:

View File

@ -2973,6 +2973,9 @@ void SymbolDatabase::printOut(const char *title) const
void SymbolDatabase::printXml(std::ostream &out) const
{
out << std::setiosflags(std::ios::boolalpha);
std::set<const Variable *> variables;
// Scopes..
out << " <scopes>" << std::endl;
for (std::list<Scope>::const_iterator scope = scopeList.begin(); scope != scopeList.end(); ++scope) {
@ -3004,6 +3007,7 @@ void SymbolDatabase::printXml(std::ostream &out) const
for (unsigned int argnr = 0; argnr < function->argCount(); ++argnr) {
const Variable *arg = function->getArgumentVar(argnr);
out << " <arg nr=\"" << argnr+1 << "\" variable=\"" << arg << "\"/>" << std::endl;
variables.insert(arg);
}
out << " </function>" << std::endl;
}
@ -3022,9 +3026,10 @@ void SymbolDatabase::printXml(std::ostream &out) const
out << " </scopes>" << std::endl;
// Variables..
for (const Variable *var : _variableList)
variables.insert(var);
out << " <variables>" << std::endl;
for (unsigned int i = 1U; i < _variableList.size(); i++) {
const Variable *var = _variableList[i];
for (const Variable *var : variables) {
if (!var)
continue;
out << " <var id=\"" << var << '\"';