File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ SELECT * FROM globals WHERE is_volatile
5454 | bases_count | Integer | Number of bases for this class |
5555 | methods_count | Integer | Number of methods declarations |
5656 | fields_count | Integer | Number of fields declarations |
57- | size_of | Integer | Class Size in bytes |
57+ | size | Integer | The size of class in bytes |
58+ | align | Integer | The align of class in bytes |
5859 | file | Text | File path |
5960 | line | Integer | Line at the file path |
6061 | column | Integer | Column at the file path |
Original file line number Diff line number Diff line change @@ -131,8 +131,13 @@ fn select_classes(
131131 continue ;
132132 }
133133
134- if field_name == "size_of" {
135- values. push ( Value :: Integer ( class. size_of ) ) ;
134+ if field_name == "size" {
135+ values. push ( Value :: Integer ( class. size ) ) ;
136+ continue ;
137+ }
138+
139+ if field_name == "align" {
140+ values. push ( Value :: Integer ( class. align ) ) ;
136141 continue ;
137142 }
138143
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ lazy_static! {
3131 map. insert( "fields_count" , DataType :: Integer ) ;
3232 map. insert( "constants_count" , DataType :: Integer ) ;
3333
34- map. insert( "size_of" , DataType :: Integer ) ;
34+ map. insert( "size" , DataType :: Integer ) ;
35+ map. insert( "align" , DataType :: Integer ) ;
3536
3637 // Source code location columns
3738 map. insert( "file" , DataType :: Text ) ;
@@ -53,7 +54,8 @@ lazy_static! {
5354 "bases_count" ,
5455 "methods_count" ,
5556 "fields_count" ,
56- "size_of" ,
57+ "size" ,
58+ "align" ,
5759 "line" ,
5860 "column" ,
5961 "offset" ,
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ pub struct ClassNode {
1212 pub name : String ,
1313 pub attributes : ClassAttributes ,
1414 pub is_struct : bool ,
15- pub size_of : i64 ,
15+ pub size : i64 ,
16+ pub align : i64 ,
1617 pub location : location:: SourceLocation ,
1718}
1819
@@ -73,7 +74,8 @@ extern "C" fn visit_class_or_struct_declaration(
7374 let is_struct = cursor_kind == CXCursor_StructDecl ;
7475
7576 let class_type = clang_getCursorType ( cursor) ;
76- let size_of = clang_Type_getSizeOf ( class_type) / 8 ;
77+ let size = clang_Type_getSizeOf ( class_type) / 8 ;
78+ let align = clang_Type_getAlignOf ( class_type) / 8 ;
7779
7880 let mut attributes = ClassAttributes :: default ( ) ;
7981 let attributes_pointer = & mut attributes as * mut ClassAttributes as * mut c_void ;
@@ -83,7 +85,8 @@ extern "C" fn visit_class_or_struct_declaration(
8385 name : class_name. to_string ( ) ,
8486 attributes,
8587 is_struct,
86- size_of,
88+ size,
89+ align,
8790 location,
8891 } ) ;
8992
You can’t perform that action at this time.
0 commit comments