[hil] class constant types

Reviewed By: jvillard

Differential Revision: D16073011

fbshipit-source-id: a05ec2b6a
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent c89a8d3e63
commit ae4f7561b3

@ -350,9 +350,8 @@ let rec get_typ tenv = function
| Constant (Cfloat _) ->
Some (Typ.mk (Typ.Tfloat Typ.FFloat))
| Constant (Cclass _) ->
(* TODO: this only happens in Java. We probably need to change it to `Cclass of Typ.Name.t`
to give a useful result here *)
None
let typ = Typ.(mk (Tstruct Name.Java.java_lang_class)) in
Some Typ.(mk (Tptr (typ, Pk_pointer)))
| Constant (Cstr _) ->
(* TODO: this will need to behave differently depending on whether we're in C++ or Java *)
None

@ -462,12 +462,14 @@ module Name = struct
let is_class = function JavaClass _ -> true | _ -> false
let java_lang_object = from_string "java.lang.Object"
let java_io_serializable = from_string "java.io.Serializable"
let java_lang_class = from_string "java.lang.Class"
let java_lang_cloneable = from_string "java.lang.Cloneable"
let java_lang_object = from_string "java.lang.Object"
let split_typename typename = Split.of_string (name typename)
let get_outer_class class_name =
@ -1436,6 +1438,7 @@ module Fieldname = struct
| _ ->
None
module Clang = struct
let from_class_name class_name field_name = Clang {class_name; field_name}
end

@ -232,6 +232,8 @@ module Name : sig
val java_io_serializable : t
val java_lang_cloneable : t
val java_lang_class : t
end
module Cpp : sig

@ -39,9 +39,8 @@ end)
(* using an indentifier for a class object, create an access path representing that lock;
this is for synchronizing on Java class objects only *)
let lock_of_class =
let type_name = Typ.Name.Java.from_string "java.lang.Class" in
let typ = Typ.mk (Typ.Tstruct type_name) in
let typ' = Typ.mk (Typ.Tptr (typ, Typ.Pk_pointer)) in
let typ = Typ.(mk (Tstruct Name.Java.java_lang_class)) in
let typ' = Typ.(mk (Tptr (typ, Pk_pointer))) in
fun class_id ->
let ident = Ident.create_normal class_id 0 in
AccessPath.of_id ident typ'

Loading…
Cancel
Save