diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 79dbedc21..d2cf28b78 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -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: diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 506824a6e..1c326eda1 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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 variables; + // Scopes.. out << " " << std::endl; for (std::list::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 << " " << std::endl; + variables.insert(arg); } out << " " << std::endl; } @@ -3022,9 +3026,10 @@ void SymbolDatabase::printXml(std::ostream &out) const out << " " << std::endl; // Variables.. + for (const Variable *var : _variableList) + variables.insert(var); out << " " << 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 << "