[Bf-blender-cvs] [3eb2724] master: Update clang array checker for new clang py api

Campbell Barton noreply at git.blender.org
Sat Mar 29 01:26:43 CET 2014


Commit: 3eb2724c14b106c648bbd2b49658c0ae76e1e815
Author: Campbell Barton
Date:   Sat Mar 29 11:07:31 2014 +1100
https://developer.blender.org/rB3eb2724c14b106c648bbd2b49658c0ae76e1e815

Update clang array checker for new clang py api

===================================================================

M	build_files/cmake/clang_array_check.py
M	build_files/cmake/cmake_static_check_clang_array.py

===================================================================

diff --git a/build_files/cmake/clang_array_check.py b/build_files/cmake/clang_array_check.py
index f29d3c7..c1421df 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 1729859..45b262a 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"
     ]




More information about the Bf-blender-cvs mailing list