Skip to content

Commit 6730973

Browse files
Chaoqiang Dengfacebook-github-bot
authored andcommitted
Rename global_write_check to global_access_check
Summary: Currently HAGVAH does check both global writes and global reads, so this diff updates the corresponding TAST checker's name from "global_write_check" to "global_access_check". Reviewed By: yuxuanchen1997 Differential Revision: D39970956 fbshipit-source-id: a536f5f043e2e4be5df02f15a3ec50d4d776096a
1 parent 3087f9e commit 6730973

44 files changed

Lines changed: 111 additions & 110 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

hphp/hack/src/errors/error_codes.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,12 @@ end
765765
(* 9xxx: reserved for FB ai *)
766766
(* 10xxx: reserved for FB ai *)
767767

768-
(* 11xxx: reserved for global write check (fbcode/hphp/hack/src/typing/tast_check/global_write_check.ml),
768+
(* 11xxx: reserved for global write check (fbcode/hphp/hack/src/typing/tast_check/global_access_check.ml),
769769
* which is used to detect data leaks through global variable access.
770770
* 11001 represents the error when a static variable is directly written.
771771
* 11002 represents the error when a global variable is written via reference.
772772
* 11003 represents the error when a global variable is passed to (or returned from) a function call.
773+
* 11004 represents the error when a global variable is directly used.
773774
*)
774775
module GlobalWriteCheck = struct
775776
type t =

hphp/hack/src/hackrs/compare_folded_decls_file.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ let () =
242242
(* The following options do not affect the direct decl parser and can be ignored
243243
(they are used by hh_single_type_check, and we run hh_single_decl over all of
244244
the typecheck test cases). *)
245-
ignored_arg "--enable-global-write-check";
246-
ignored_arg "--enable-global-write-check-functions";
245+
ignored_arg "--enable-global-access-check";
246+
ignored_arg "--enable-global-access-check-functions";
247247
ignored_flag "--abstract-static-props";
248248
ignored_arg "--allowed-decl-fixme-codes";
249249
ignored_arg "--allowed-fixme-codes-strict";

hphp/hack/src/hh_oxidize/convert_toplevel_phrase.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ let enum_modules =
7575
("error_codes", "NastCheck");
7676
("error_codes", "Typing");
7777
("error_codes", "Init");
78-
(* An optional error set that runs only for arg --enable-global-write-check
79-
or --enable-global-write-check-function. *)
78+
(* An optional error set that runs only for arg --enable-global-access-check
79+
or --enable-global-access-check-function. *)
8080
("error_codes", "GlobalWriteCheck");
8181
]
8282

hphp/hack/src/hh_single_decl.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ let () =
241241
(* The following options do not affect the direct decl parser and can be ignored
242242
(they are used by hh_single_type_check, and we run hh_single_decl over all of
243243
the typecheck test cases). *)
244-
ignored_arg "--enable-global-write-check";
245-
ignored_arg "--enable-global-write-check-functions";
244+
ignored_arg "--enable-global-access-check";
245+
ignored_arg "--enable-global-access-check-functions";
246246
ignored_flag "--abstract-static-props";
247247
ignored_arg "--allowed-decl-fixme-codes";
248248
ignored_arg "--allowed-fixme-codes-strict";

hphp/hack/src/hh_single_type_check.ml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -328,22 +328,22 @@ let parse_options () =
328328
ref (TypecheckerOptions.profile_top_level_definitions GlobalOptions.default)
329329
in
330330
let memtrace = ref None in
331-
let enable_global_write_check = ref [] in
332-
let enable_global_write_check_functions = ref SSet.empty in
331+
let enable_global_access_check = ref [] in
332+
let enable_global_access_check_functions = ref SSet.empty in
333333
let refactor_mode = ref "" in
334334
let refactor_analysis_mode = ref "" in
335-
let set_enable_global_write_check_functions s =
335+
let set_enable_global_access_check_functions s =
336336
let json_obj = Hh_json.json_of_file s in
337337
let add_function f =
338338
match f with
339339
| Hh_json.JSON_String str ->
340-
enable_global_write_check_functions :=
341-
SSet.add str !enable_global_write_check_functions
340+
enable_global_access_check_functions :=
341+
SSet.add str !enable_global_access_check_functions
342342
| _ -> ()
343343
in
344344
match json_obj with
345345
| Hh_json.JSON_Array lst -> List.iter lst ~f:add_function
346-
| _ -> enable_global_write_check_functions := SSet.empty
346+
| _ -> enable_global_access_check_functions := SSet.empty
347347
in
348348
let allow_all_files_for_module_declarations = ref true in
349349
let loop_iteration_upper_bound = ref None in
@@ -814,13 +814,13 @@ let parse_options () =
814814
" Sets the amount of fuel that the type printer can use to display an individual type. Default: "
815815
^ string_of_int
816816
(TypecheckerOptions.type_printer_fuel GlobalOptions.default) );
817-
( "--enable-global-write-check",
817+
( "--enable-global-access-check",
818818
Arg.String
819-
(fun s -> enable_global_write_check := String_utils.split ',' s),
819+
(fun s -> enable_global_access_check := String_utils.split ',' s),
820820
" Run global write checker on any file whose path is prefixed by the argument (use \"\\\" for hh_single_type_check)"
821821
);
822-
( "--enable-global-write-check-functions",
823-
Arg.String set_enable_global_write_check_functions,
822+
( "--enable-global-access-check-functions",
823+
Arg.String set_enable_global_access_check_functions,
824824
" Run global write checker on functions listed in the given JSON file"
825825
);
826826
( "--overwrite-loop-iteration-upper-bound",
@@ -965,9 +965,9 @@ let parse_options () =
965965
["/"]
966966
else
967967
[])
968-
~tco_global_write_check_enabled:!enable_global_write_check
969-
~tco_global_write_check_functions_enabled:
970-
!enable_global_write_check_functions
968+
~tco_global_access_check_enabled:!enable_global_access_check
969+
~tco_global_access_check_functions_enabled:
970+
!enable_global_access_check_functions
971971
~tco_use_direct_decl_parser:!use_direct_decl_parser
972972
~po_enable_enum_classes:(not !disable_enum_classes)
973973
~po_interpret_soft_types_as_like_types:!interpret_soft_types_as_like_types

hphp/hack/src/naming/naming_special_names.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ module UserAttributes = struct
350350
let uaNoFlatten = "__NoFlatten"
351351

352352
(* <<__SafeForGlobalWriteCheck>> marks global variables as safe from mutations.
353-
This attribute merely ensures that the global_write_check does NOT raise
353+
This attribute merely ensures that the global_access_check does NOT raise
354354
errors/warnings from writing to the annotated global variable, and it
355355
has NO runtime/semantic implication. *)
356356
let uaSafeGlobalVariable = "__SafeForGlobalWriteCheck"
@@ -698,7 +698,7 @@ module UserAttributes = struct
698698
autocomplete = false;
699699
doc =
700700
"Marks this global variable as safe from mutation."
701-
^ " This ensures the global_write_check does NOT raise errors/warnings from writing to this global variable.";
701+
^ " This ensures the global_access_check does NOT raise errors/warnings from writing to this global variable.";
702702
} );
703703
])
704704

hphp/hack/src/options/globalOptions.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ type t = {
128128
po_disallow_inst_meth: bool;
129129
tco_use_direct_decl_parser: bool;
130130
tco_ifc_enabled: string list;
131-
tco_global_write_check_enabled: string list;
132-
tco_global_write_check_functions_enabled: SSet.t;
131+
tco_global_access_check_enabled: string list;
132+
tco_global_access_check_functions_enabled: SSet.t;
133133
po_enable_enum_supertyping: bool;
134134
po_interpret_soft_types_as_like_types: bool;
135135
tco_enable_strict_string_concat_interp: bool;
@@ -268,8 +268,8 @@ let default =
268268
po_disallow_inst_meth = false;
269269
tco_use_direct_decl_parser = true;
270270
tco_ifc_enabled = [];
271-
tco_global_write_check_enabled = [];
272-
tco_global_write_check_functions_enabled = SSet.empty;
271+
tco_global_access_check_enabled = [];
272+
tco_global_access_check_functions_enabled = SSet.empty;
273273
po_enable_enum_supertyping = true;
274274
po_interpret_soft_types_as_like_types = false;
275275
tco_enable_strict_string_concat_interp = false;
@@ -419,9 +419,9 @@ let make
419419
?(po_disallow_inst_meth = default.po_disallow_inst_meth)
420420
?(tco_use_direct_decl_parser = default.tco_use_direct_decl_parser)
421421
?(tco_ifc_enabled = default.tco_ifc_enabled)
422-
?(tco_global_write_check_enabled = default.tco_global_write_check_enabled)
423-
?(tco_global_write_check_functions_enabled =
424-
default.tco_global_write_check_functions_enabled)
422+
?(tco_global_access_check_enabled = default.tco_global_access_check_enabled)
423+
?(tco_global_access_check_functions_enabled =
424+
default.tco_global_access_check_functions_enabled)
425425
?(po_enable_enum_supertyping = default.po_enable_enum_supertyping)
426426
?(po_interpret_soft_types_as_like_types =
427427
default.po_interpret_soft_types_as_like_types)
@@ -572,8 +572,8 @@ let make
572572
po_disallow_inst_meth;
573573
tco_use_direct_decl_parser;
574574
tco_ifc_enabled;
575-
tco_global_write_check_enabled;
576-
tco_global_write_check_functions_enabled;
575+
tco_global_access_check_enabled;
576+
tco_global_access_check_functions_enabled;
577577
po_enable_enum_supertyping;
578578
po_interpret_soft_types_as_like_types;
579579
tco_enable_strict_string_concat_interp;

hphp/hack/src/options/globalOptions.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ type t = {
260260
(* Enable global write check on the specified list of path prefixes
261261
(a list containing the empty string would denote all files,
262262
an empty list denotes no files) *)
263-
tco_global_write_check_enabled: string list;
263+
tco_global_access_check_enabled: string list;
264264
(* Enable global write check on the spcified set of functions
265265
(Empty denotes no functions) *)
266-
tco_global_write_check_functions_enabled: SSet.t;
266+
tco_global_access_check_functions_enabled: SSet.t;
267267
(* Enables the enum supertyping extension *)
268268
po_enable_enum_supertyping: bool;
269269
(* <<__Soft>> T -> ~T *)
@@ -439,8 +439,8 @@ val make :
439439
?po_disallow_inst_meth:bool ->
440440
?tco_use_direct_decl_parser:bool ->
441441
?tco_ifc_enabled:string list ->
442-
?tco_global_write_check_enabled:string list ->
443-
?tco_global_write_check_functions_enabled:SSet.t ->
442+
?tco_global_access_check_enabled:string list ->
443+
?tco_global_access_check_functions_enabled:SSet.t ->
444444
?po_enable_enum_supertyping:bool ->
445445
?po_interpret_soft_types_as_like_types:bool ->
446446
?tco_enable_strict_string_concat_interp:bool ->

hphp/hack/src/options/typecheckerOptions.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ let enable_ifc t = GlobalOptions.{ t with tco_ifc_enabled = ["/"] }
155155

156156
let ifc_enabled t = t.GlobalOptions.tco_ifc_enabled
157157

158-
let enable_global_write_check t =
159-
GlobalOptions.{ t with tco_global_write_check_enabled = ["/"] }
158+
let enable_global_access_check t =
159+
GlobalOptions.{ t with tco_global_access_check_enabled = ["/"] }
160160

161-
let global_write_check_enabled t =
162-
t.GlobalOptions.tco_global_write_check_enabled
161+
let global_access_check_enabled t =
162+
t.GlobalOptions.tco_global_access_check_enabled
163163

164-
let global_write_check_functions_enabled t =
165-
t.GlobalOptions.tco_global_write_check_functions_enabled
164+
let global_access_check_functions_enabled t =
165+
t.GlobalOptions.tco_global_access_check_functions_enabled
166166

167167
let like_type_hints t = t.GlobalOptions.tco_like_type_hints
168168

hphp/hack/src/oxidized/gen/global_options.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This source code is licensed under the MIT license found in the
44
// LICENSE file in the "hack" directory of this source tree.
55
//
6-
// @generated SignedSource<<955fb16eed4d702f3264d0e911f1cf60>>
6+
// @generated SignedSource<<618c9c7aba2f3189646de21f775d6491>>
77
//
88
// To regenerate this file, run:
99
// hphp/hack/src/oxidized_regen.sh
@@ -133,8 +133,8 @@ pub struct GlobalOptions {
133133
pub po_disallow_inst_meth: bool,
134134
pub tco_use_direct_decl_parser: bool,
135135
pub tco_ifc_enabled: Vec<String>,
136-
pub tco_global_write_check_enabled: Vec<String>,
137-
pub tco_global_write_check_functions_enabled: s_set::SSet,
136+
pub tco_global_access_check_enabled: Vec<String>,
137+
pub tco_global_access_check_functions_enabled: s_set::SSet,
138138
pub po_enable_enum_supertyping: bool,
139139
pub po_interpret_soft_types_as_like_types: bool,
140140
pub tco_enable_strict_string_concat_interp: bool,

0 commit comments

Comments
 (0)