diff --git a/tools/clang-ast.cpp b/tools/clang-ast.cpp index 6eb5f545c..62a2e0165 100644 --- a/tools/clang-ast.cpp +++ b/tools/clang-ast.cpp @@ -47,7 +47,7 @@ int main(int argc, char **argv) unsigned int line, column; clang_getPresumedLocation(location, &filename, &line, &column); - std::cout << "<" << clang_getCursorKindSpelling(clang_getCursorKind(c)) + std::cout << " +# Then that means there is a missing function in the Cppcheck SymbolDatabase +# +import subprocess +import sys +sys.path.insert(0, '../addons') +import cppcheckdata + +CLANG_AST = './clang-ast' +CPPCHECK = '../cppcheck' + +def clang_ast(sourcefile): + p = subprocess.Popen([CLANG_AST,sourcefile], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + comm = p.communicate() + ret = [] + for line in comm[0].split('\n'): + while len(line)>1 and line[-1] in ' \r\n': + line = line[:-1] + if line.find('/usr/') > 0: + continue + if line.startswith('' + ret.append(s) + for scope in cfg.scopes: + if scope.type != 'Function': + continue + argStart = scope.bodyStart + while argStart and argStart.str != '(': + argStart = argStart.previous + s = '' + if s not in ret: + ret.append(s) + ret.sort() + return ret + +print('Clang AST...') +ast1 = clang_ast(sys.argv[1]) +print('Cppcheck AST...') +ast2 = cppcheck_ast(sys.argv[1]) + +#for func in ast2: +# print(func) + +print('Compare...') +for func in ast1: + if func not in ast2: + print('- ' + func) +#for func in ast2: +# if func not in ast1: +# print('+ ' + func)