From fce7a0a1284cb1fb83a684580167954c98706295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 30 Apr 2018 16:52:51 +0200 Subject: [PATCH] dump: add Function::type --- addons/cppcheckdata.py | 2 ++ lib/symboldatabase.cpp | 7 +++++++ tools/compare-ast-clang-and-cppcheck.py | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 529eefe35..0afc7faf7 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -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') diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 180abaa21..a08b89d45 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2874,6 +2874,13 @@ void SymbolDatabase::printXml(std::ostream &out) const out << " " << std::endl; for (std::list::const_iterator function = scope->functionList.begin(); function != scope->functionList.end(); ++function) { out << " 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\""; diff --git a/tools/compare-ast-clang-and-cppcheck.py b/tools/compare-ast-clang-and-cppcheck.py index 36ebb9be2..21adb681c 100644 --- a/tools/compare-ast-clang-and-cppcheck.py +++ b/tools/compare-ast-clang-and-cppcheck.py @@ -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 = ''