[infer] Disable sorting fields

Summary:
The struct fields in Cil have been sorted for long time, however the
checkers do not seem to depend on the sortedness.

Reviewed By: sblackshear

Differential Revision: D7027858

fbshipit-source-id: 9e7ab96
master
Sungkeun Cho 7 years ago committed by Facebook Github Bot
parent dbc8a4af50
commit 077d2ae2f5

@ -23,8 +23,6 @@ end)
(** Type for type environment. *)
type t = Typ.Struct.t TypenameHash.t
let iter f tenv = TypenameHash.iter f tenv
let pp fmt (tenv: t) =
TypenameHash.iter
(fun name typ ->
@ -62,15 +60,6 @@ let compare_fields (name1, _, _) (name2, _, _) = Typ.Fieldname.compare name1 nam
let equal_fields f1 f2 = Int.equal (compare_fields f1 f2) 0
let sort_fields fields = List.sort ~cmp:compare_fields fields
let sort_fields_tenv tenv =
let sort_fields_struct name ({Typ.Struct.fields} as st) =
ignore (mk_struct tenv ~default:st ~fields:(sort_fields fields) name)
in
iter sort_fields_struct tenv
(** Add a field to a given struct in the global type environment. *)
let add_field tenv class_tn_name field =
match lookup tenv class_tn_name with

@ -41,8 +41,6 @@ val mk_struct :
val add_field : t -> Typ.Name.t -> Typ.Struct.field -> unit
(** Add a field to a given struct in the global type environment. *)
val sort_fields_tenv : t -> unit
val pp : Format.formatter -> t -> unit [@@warning "-32"]
(** print a type environment *)

@ -52,7 +52,6 @@ let do_source_file (translation_unit_context: CFrontend_config.translation_unit_
(* This could be moved in the cfg_infer module *)
NullabilityPreanalysis.analysis cfg tenv ;
Cfg.store source_file cfg ;
Tenv.sort_fields_tenv tenv ;
Tenv.store source_file tenv ;
if Config.debug_mode then Cfg.check_cfg_connectedness cfg ;
if Config.debug_mode || Config.testing_mode || Config.frontend_tests

@ -22,7 +22,7 @@ codetoanalyze/cpp/bufferoverrun/vector.cpp, assert_Good_FP, 6, BUFFER_OVERRUN_L3
codetoanalyze/cpp/bufferoverrun/vector.cpp, data_Bad, 4, BUFFER_OVERRUN_L1, [Call,Call,Assignment,Call,Call,ArrayDeclaration,Assignment,Assignment,Return,Assignment,Assignment,Return,Assignment,Assignment,ArrayAccess: Offset: [10, 10] Size: [5, 5]]
codetoanalyze/cpp/bufferoverrun/vector.cpp, just_test_model_FP, 16, BUFFER_OVERRUN_L5, [Call,ArrayAccess: Offset: [-oo, +oo] Size: [0, +oo]]
codetoanalyze/cpp/bufferoverrun/vector.cpp, just_test_model_FP, 18, BUFFER_OVERRUN_L3, [Call,Call,Call,Assignment,Call,Call,Call,Call,Call,ArrayDeclaration,Assignment,ArrayAccess: Offset: [1, 1] Size: [0, +oo]]
codetoanalyze/cpp/bufferoverrun/vector.cpp, out_of_bound_Bad, 2, BUFFER_OVERRUN_L2, [Call,Call,Call,ArrayDeclaration,Assignment,ArrayAccess: Offset: [u$12, u$13] Size: [u$12, u$13]]
codetoanalyze/cpp/bufferoverrun/vector.cpp, out_of_bound_Bad, 2, BUFFER_OVERRUN_L2, [Call,Call,Call,ArrayDeclaration,Assignment,ArrayAccess: Offset: [u$4, u$5] Size: [u$4, u$5]]
codetoanalyze/cpp/bufferoverrun/vector.cpp, precise_subst_Bad, 3, BUFFER_OVERRUN_L1, [ArrayDeclaration,Call,Assignment,Call,Assignment,Call,Call,Assignment,Return,ArrayAccess: Offset: [-1, -1] Size: [10, 10] @ codetoanalyze/cpp/bufferoverrun/vector.cpp:206:3 by call `access_minus_one()` ]
codetoanalyze/cpp/bufferoverrun/vector.cpp, precise_subst_Good_FP, 3, BUFFER_OVERRUN_L3, [ArrayDeclaration,Call,Assignment,Call,Assignment,Call,Call,Assignment,Return,ArrayAccess: Offset: [-1, 0] Size: [10, 10] @ codetoanalyze/cpp/bufferoverrun/vector.cpp:206:3 by call `access_minus_one()` ]
codetoanalyze/cpp/bufferoverrun/vector.cpp, push_back_Bad, 3, BUFFER_OVERRUN_L1, [Call,Call,Assignment,Call,Assignment,Call,Call,ArrayDeclaration,Assignment,ArrayAccess: Offset: [1, 1] Size: [1, 1]]

Loading…
Cancel
Save