[thread-safety] don't warn on external accesses to fields of ThreadConfined classes

Reviewed By: jaegs

Differential Revision: D4490858

fbshipit-source-id: e955a32
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent cef2f0e055
commit f6e8bf0f3f

@ -92,6 +92,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
begin
match Tenv.lookup tenv typename with
| Some struct_typ ->
Annotations.struct_typ_has_annot struct_typ Annotations.ia_is_thread_confined ||
Annotations.field_has_annot
fieldname struct_typ Annotations.ia_is_thread_confined ||
Annotations.field_has_annot fieldname struct_typ Annotations.ia_is_volatile

@ -121,6 +121,9 @@ let field_has_annot fieldname (struct_typ : StructTyp.t) predicate =
IList.exists fld_has_taint_annot struct_typ.fields ||
IList.exists fld_has_taint_annot struct_typ.statics
let struct_typ_has_annot (struct_typ : StructTyp.t) predicate =
predicate struct_typ.annots
let ia_is_not_thread_safe ia =
ia_ends_with ia not_thread_safe

@ -143,6 +143,9 @@ val ma_has_annotation_with : Annot.Method.t -> (Annot.t -> bool) -> bool
val field_has_annot : Ident.fieldname -> StructTyp.t -> (Annot.Item.t -> bool) -> bool
(** return true if the given predicate evaluates to true on some annotation of [struct_typ] *)
val struct_typ_has_annot : StructTyp.t -> (Annot.Item.t -> bool) -> bool
(** Mark the return of the method_annotation with the given annotation. *)
val method_annotation_mark_return :
annotation -> Annot.Method.t -> Annot.Method.t

@ -79,10 +79,14 @@ class Annotations implements FunctionalInterface {
Confined con;
public void confinedCaller(){
public void confinedCallerOk(){
con.foo();
}
public void writeFieldOfConfinedClassOk() {
con.x = 7;
}
@ThreadConfined
class Confined {
Integer x;

Loading…
Cancel
Save