Skip to content

Commit

Permalink
[infer] Make sure that pulse-transitive-access-config is treated the …
Browse files Browse the repository at this point in the history
…same way when provided via CLI and inferconfig

Summary: Make sure that pulse-transitive-access-config is treated the same way when provided via CLI and inferconfig

Reviewed By: ngorogiannis

Differential Revision: D52782793

fbshipit-source-id: d99b5ebbfd200e951ab32d33c2b033f51e65c7a4
  • Loading branch information
geralt-encore authored and facebook-github-bot committed Jan 15, 2024
1 parent 7c606ee commit 7189cd1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion infer/man/man1/infer-analyze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ CLANG OPTIONS

--lock-model json
Specify custom lock models for starvation analysis.
Example for pthreads (already included in infer):
Example for pthreads (already included in infer):
[{"lock":["pthread_mutex_lock"],"unlock":["pthread_mutex_unlock"]}]


Expand Down
4 changes: 2 additions & 2 deletions infer/man/man1/infer-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ OPTIONS

--lock-model json
Specify custom lock models for starvation analysis.
Example for pthreads (already included in infer):
Example for pthreads (already included in infer):
[{"lock":["pthread_mutex_lock"],"unlock":["pthread_mutex_unlock"]}]

See also infer-analyze(1).
Expand Down Expand Up @@ -2754,7 +2754,7 @@ INTERNAL OPTIONS
--pulse-taint-config-reset
Set --pulse-taint-config to the empty list.

--pulse-transitive-access-config path
--pulse-transitive-access-config string
Specifies the accesses that must be tracked and the entry methods.
Here is an example of the intended JSON syntax:
{
Expand Down
2 changes: 1 addition & 1 deletion infer/man/man1/infer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ OPTIONS

--lock-model json
Specify custom lock models for starvation analysis.
Example for pthreads (already included in infer):
Example for pthreads (already included in infer):
[{"lock":["pthread_mutex_lock"],"unlock":["pthread_mutex_unlock"]}]

See also infer-analyze(1).
Expand Down
4 changes: 2 additions & 2 deletions infer/src/base/Config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@ and lock_model =
CLOpt.mk_json ~long:"lock-model"
~in_help:InferCommand.[(Analyze, manual_clang)]
{|Specify custom lock models for starvation analysis.
Example for pthreads (already included in infer):
Example for pthreads (already included in infer):
[{"lock":["pthread_mutex_lock"],"unlock":["pthread_mutex_unlock"]}] |}


Expand Down Expand Up @@ -2673,7 +2673,7 @@ and pulse_taint_skip_sources =


and pulse_transitive_access_config =
CLOpt.mk_path_opt ~long:"pulse-transitive-access-config"
CLOpt.mk_string_opt ~long:"pulse-transitive-access-config"
{|Specifies the accesses that must be tracked and the entry methods.
Here is an example of the intended JSON syntax:
{
Expand Down
23 changes: 12 additions & 11 deletions infer/src/pulse/PulseTransitiveAccessChecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,18 @@ end = struct
| None ->
()
| Some filepath -> (
match Utils.read_safe_json_file filepath with
| Ok (`List []) ->
L.die ExternalError "The content of transitive-access JSON config is empty@."
| Ok json -> (
try t_of_yojson json |> set
with _ ->
L.die ExternalError "Could not read or parse transitive-access JSON config in %s@."
filepath )
| Error msg ->
L.die ExternalError "Could not read or parse transitive-access JSON config in %s:@\n%s@."
filepath msg )
let filepath = Utils.filename_to_absolute filepath ~root:Config.project_root in
match Utils.read_safe_json_file filepath with
| Ok (`List []) ->
L.die ExternalError "The content of transitive-access JSON config is empty@."
| Ok json -> (
try t_of_yojson json |> set
with _ ->
L.die ExternalError "Could not read or parse transitive-access JSON config in %s@."
filepath )
| Error msg ->
L.die ExternalError
"Could not read or parse transitive-access JSON config in %s:@\n%s@." filepath msg )
end

let record_load rhs_exp location astates =
Expand Down

0 comments on commit 7189cd1

Please sign in to comment.