dump: add Function::type
This commit is contained in:
parent
05184555b2
commit
fce7a0a128
|
@ -316,6 +316,7 @@ class Function:
|
||||||
tokenDef = None
|
tokenDef = None
|
||||||
tokenDefId = None
|
tokenDefId = None
|
||||||
name = None
|
name = None
|
||||||
|
type = None
|
||||||
isVirtual = None
|
isVirtual = None
|
||||||
isImplicitlyVirtual = None
|
isImplicitlyVirtual = None
|
||||||
|
|
||||||
|
@ -323,6 +324,7 @@ class Function:
|
||||||
self.Id = element.get('id')
|
self.Id = element.get('id')
|
||||||
self.tokenDefId = element.get('tokenDef')
|
self.tokenDefId = element.get('tokenDef')
|
||||||
self.name = element.get('name')
|
self.name = element.get('name')
|
||||||
|
self.type = element.get('type')
|
||||||
isVirtual = element.get('isVirtual')
|
isVirtual = element.get('isVirtual')
|
||||||
self.isVirtual = (isVirtual and isVirtual == 'true')
|
self.isVirtual = (isVirtual and isVirtual == 'true')
|
||||||
isImplicitlyVirtual = element.get('isImplicitlyVirtual')
|
isImplicitlyVirtual = element.get('isImplicitlyVirtual')
|
||||||
|
|
|
@ -2874,6 +2874,13 @@ void SymbolDatabase::printXml(std::ostream &out) const
|
||||||
out << " <functionList>" << std::endl;
|
out << " <functionList>" << std::endl;
|
||||||
for (std::list<Function>::const_iterator function = scope->functionList.begin(); function != scope->functionList.end(); ++function) {
|
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 << " <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->nestedIn->definedType) {
|
||||||
if (function->isVirtual())
|
if (function->isVirtual())
|
||||||
out << " isVirtual=\"true\"";
|
out << " isVirtual=\"true\"";
|
||||||
|
|
|
@ -40,8 +40,11 @@ def cppcheck_ast(sourcefile):
|
||||||
cfg = data.configurations[0]
|
cfg = data.configurations[0]
|
||||||
ret = []
|
ret = []
|
||||||
for func in cfg.functions:
|
for func in cfg.functions:
|
||||||
|
name = func.name
|
||||||
|
if func.type == 'Destructor':
|
||||||
|
name = '~' + name
|
||||||
s = '<Function'
|
s = '<Function'
|
||||||
s = s + ' name="' + func.name + '"'
|
s = s + ' name="' + name + '"'
|
||||||
s = s + ' filename="' + func.tokenDef.file + '"'
|
s = s + ' filename="' + func.tokenDef.file + '"'
|
||||||
s = s + ' line="' + str(func.tokenDef.linenr) + '"'
|
s = s + ' line="' + str(func.tokenDef.linenr) + '"'
|
||||||
s = s + '/>'
|
s = s + '/>'
|
||||||
|
|
Loading…
Reference in New Issue