diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-29 04:07:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-29 04:08:24 +0400 |
commit | 3eb2724c14b106c648bbd2b49658c0ae76e1e815 (patch) | |
tree | 50d1a032518dcf4dc6d877d49034128fb84d4416 /build_files | |
parent | aec4367226e16912709f43cc777a6afe9ee9e1e9 (diff) |
Update clang array checker for new clang py api
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/clang_array_check.py | 17 | ||||
-rw-r--r-- | build_files/cmake/cmake_static_check_clang_array.py | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/build_files/cmake/clang_array_check.py b/build_files/cmake/clang_array_check.py index f29d3c75608..c1421dfadd3 100644 --- a/build_files/cmake/clang_array_check.py +++ b/build_files/cmake/clang_array_check.py @@ -117,6 +117,7 @@ args = sys.argv[2:] tu = index.parse(sys.argv[1], args) # print('Translation unit: %s' % tu.spelling) +filepath = tu.spelling # ----------------------------------------------------------------------------- @@ -200,14 +201,12 @@ def function_get_arg_sizes(node): for i, node_child in enumerate(node_parms): # print(node_child.kind, node_child.spelling) - #print(node_child.type.kind, node_child.spelling) # TypeKind.POINTER - - if node_child.type.kind == TypeKind.POINTER: + #print(node_child.type.kind, node_child.spelling) + if node_child.type.kind == TypeKind.CONSTANTARRAY: pointee = node_child.type.get_pointee() - if pointee.is_pod(): - size = parm_size(node_child) - if size != -1: - arg_sizes[i] = size + size = parm_size(node_child) + if size != -1: + arg_sizes[i] = size return arg_sizes @@ -292,7 +291,7 @@ def file_check_arg_sizes(tu): if arg.kind in (CursorKind.DECL_REF_EXPR, CursorKind.UNEXPOSED_EXPR): - if arg.type.kind == TypeKind.POINTER: + if arg.type.kind == TypeKind.CONSTANTARRAY: dec = arg.get_definition() if dec: size = parm_size(dec) @@ -324,7 +323,7 @@ def file_check_arg_sizes(tu): location.line, location.column, i + 1, size, size_def, - args[0] # always the same but useful when running threaded + filepath # always the same but useful when running threaded )) # we dont really care what we are looking at, just scan entire file for diff --git a/build_files/cmake/cmake_static_check_clang_array.py b/build_files/cmake/cmake_static_check_clang_array.py index 17298599bdd..45b262a13ce 100644 --- a/build_files/cmake/cmake_static_check_clang_array.py +++ b/build_files/cmake/cmake_static_check_clang_array.py @@ -41,6 +41,8 @@ CHECKER_ARGS = [ os.path.join(os.path.dirname(__file__), "clang_array_check.py"), # not sure why this is needed, but it is. "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"), + # stupid but needed + "-Dbool=char" ] |