ppx_compare CFrontend_utils

Reviewed By: cristianoc

Differential Revision: D4232412

fbshipit-source-id: 1f3c5bc
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent 71664c7828
commit 0c8a583cb0

@ -108,45 +108,14 @@ struct
}
| _ -> make_name_decl property_name.Clang_ast_t.ni_name
let property_attribute_compare att1 att2 =
match att1, att2 with
`Readonly, `Readonly -> 0
| `Readonly, _ -> -1
| _, `Readonly -> 1
| `Assign, `Assign -> 0
| `Assign, _ -> -1
| _, `Assign -> 1
| `Readwrite, `Readwrite -> 0
| `Readwrite, _ -> -1
| _, `Readwrite -> 1
| `Retain, `Retain -> 0
| `Retain, _ -> -1
| _, `Retain -> 1
| `Copy, `Copy -> 0
| `Copy, _ -> -1
| _, `Copy -> 1
| `Nonatomic, `Nonatomic -> 0
| `Nonatomic, _ -> -1
| _, `Nonatomic -> 1
| `Atomic, `Atomic -> 0
| `Atomic, _ -> 1
| _, `Atomic -> 1
| `Weak, `Weak -> 0
| `Weak, _ -> -1
| _, `Weak -> 1
| `Strong, `Strong -> 0
| `Strong, _ -> -1
| _, `Strong -> 1
| `Unsafe_unretained, `Unsafe_unretained -> 0
| `Unsafe_unretained, _ -> -1
| _, `Unsafe_unretained -> 1
| `ExplicitGetter, `ExplicitGetter -> 0
| `ExplicitGetter, _ -> -1
| _, `ExplicitGetter -> 1
| `ExplicitSetter, `ExplicitSetter -> 0
let property_attribute_eq att1 att2 =
property_attribute_compare att1 att2 = 0
let compare_property_attribute =
[%compare: [
`Readonly | `Assign | `Readwrite | `Retain | `Copy | `Nonatomic | `Atomic
| `Weak | `Strong | `Unsafe_unretained | `ExplicitGetter | `ExplicitSetter
]]
let equal_property_attribute att1 att2 =
compare_property_attribute att1 att2 = 0
let get_memory_management_attributes () =
[`Assign; `Retain; `Copy; `Weak; `Strong; `Unsafe_unretained]

@ -26,13 +26,13 @@ sig
val property_name : Clang_ast_t.obj_c_property_impl_decl_info -> Clang_ast_t.named_decl_info
val property_attribute_compare :
val compare_property_attribute :
Clang_ast_t.property_attribute -> Clang_ast_t.property_attribute -> int
val generated_ivar_name :
Clang_ast_t.named_decl_info -> Clang_ast_t.named_decl_info
val property_attribute_eq :
val equal_property_attribute :
Clang_ast_t.property_attribute -> Clang_ast_t.property_attribute -> bool
val get_memory_management_attributes : unit -> Clang_ast_t.property_attribute list

@ -122,7 +122,7 @@ let is_ivar_atomic stmt =
(match Ast_utils.get_decl ivar_pointer with
| Some d ->
let attributes = get_ivar_attributes d in
IList.exists (Ast_utils.property_attribute_eq `Atomic) attributes
IList.exists (Ast_utils.equal_property_attribute `Atomic) attributes
| _ -> false)
| _ -> false

Loading…
Cancel
Save