MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / compare_ast_symdb

Function compare_ast_symdb

tools/compare_ast_symdb.py:59–85  ·  view source on GitHub ↗
(cppcheck_parameters: str)

Source from the content-addressed store, hash-verified

57
58
59def compare_ast_symdb(cppcheck_parameters: str):
60 same = True
61 debug1 = run_cppcheck(cppcheck_parameters, '')
62 debug2 = run_cppcheck(cppcheck_parameters, '--clang')
63
64 ast1 = get_ast(debug1)
65 ast2 = get_ast(debug2)
66 if ast1 != ast2:
67 print("ast is not the same: {}".format(cppcheck_parameters))
68 with open('cppcheck.ast', 'wt') as f:
69 f.write(ast1)
70 with open('clang.ast', 'wt') as f:
71 f.write(ast2)
72 same = False
73
74 symdb1 = get_symdb(debug1)
75 symdb2 = get_symdb(debug2)
76 if symdb1 != symdb2:
77 print("symdb is not the same: {}".format(cppcheck_parameters))
78 with open('cppcheck.symdb', 'wt') as f:
79 f.write(symdb1)
80 with open('clang.symdb', 'wt') as f:
81 f.write(symdb2)
82 same = False
83
84 if not same:
85 sys.exit(1)
86
87for arg in sys.argv[1:]:
88 print(arg)

Callers 1

Calls 5

run_cppcheckFunction · 0.85
get_astFunction · 0.85
get_symdbFunction · 0.85
formatMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected