dump: add Function::type

This commit is contained in:
Daniel Marjamäki 2018-04-30 16:52:51 +02:00
parent 05184555b2
commit fce7a0a128
3 changed files with 13 additions and 1 deletions

View File

@ -316,6 +316,7 @@ class Function:
tokenDef = None
tokenDefId = None
name = None
type = None
isVirtual = None
isImplicitlyVirtual = None
@ -323,6 +324,7 @@ class Function:
self.Id = element.get('id')
self.tokenDefId = element.get('tokenDef')
self.name = element.get('name')
self.type = element.get('type')
isVirtual = element.get('isVirtual')
self.isVirtual = (isVirtual and isVirtual == 'true')
isImplicitlyVirtual = element.get('isImplicitlyVirtual')

View File

@ -2874,6 +2874,13 @@ void SymbolDatabase::printXml(std::ostream &out) const
out << " <functionList>" << std::endl;
for (std::list<Function>::const_iterator function = scope->functionList.begin(); function != scope->functionList.end(); ++function) {
out << " <function id=\"" << &*function << "\" tokenDef=\"" << function->tokenDef << "\" name=\"" << ErrorLogger::toxml(function->name()) << '\"';
out << " type=\"" << (function->type == Function::eConstructor? "Constructor" :
function->type == Function::eCopyConstructor ? "CopyConstructor" :
function->type == Function::eMoveConstructor ? "MoveConstructor" :
function->type == Function::eOperatorEqual ? "OperatorEqual" :
function->type == Function::eDestructor ? "Destructor" :
function->type == Function::eFunction ? "Function" :
"Unknown") << '\"';
if (function->nestedIn->definedType) {
if (function->isVirtual())
out << " isVirtual=\"true\"";

View File

@ -40,8 +40,11 @@ def cppcheck_ast(sourcefile):
cfg = data.configurations[0]
ret = []
for func in cfg.functions:
name = func.name
if func.type == 'Destructor':
name = '~' + name
s = '<Function'
s = s + ' name="' + func.name + '"'
s = s + ' name="' + name + '"'
s = s + ' filename="' + func.tokenDef.file + '"'
s = s + ' line="' + str(func.tokenDef.linenr) + '"'
s = s + '/>'