[LockConsistency] Checking for both type ObjC_Cpp and C to include c-style functions.

Summary:
When C++ functions are translated to SIL procedures, their type is C rather then C++. In RacerD, we want to treat C++ functions the same as C++ methods.
Added a function to check if the procedure is Objc/Objc++/C/C++.

Reviewed By: sblackshear

Differential Revision: D6209523

fbshipit-source-id: 293f938
master
Daiva Naudziuniene 7 years ago committed by Facebook Github Bot
parent f739d73ed5
commit bb90c94939

@ -657,6 +657,8 @@ module Procname = struct
let is_c_method = function ObjC_Cpp _ -> true | _ -> false
let is_obj_c_pp = function ObjC_Cpp _ | C _ -> true | _ -> false
let is_constexpr = function ObjC_Cpp {kind= CPPConstructor (_, true)} -> true | _ -> false
(** Replace the class name component of a procedure name.

@ -347,6 +347,9 @@ module Procname : sig
val is_c_method : t -> bool
(** Check if this is an Objective-C/C++ method name. *)
val is_obj_c_pp : t -> bool
(** Check if this is an Objective-C/C++ method name or C-style function. *)
val is_objc_constructor : string -> bool
(** Check if this is a constructor method in Objective-C. *)

@ -1723,4 +1723,3 @@ let file_analysis {Callbacks.procedures} =
else (module MayAliasQuotientedAccessListMap) )
class_env))
(aggregate_by_class procedures)

@ -133,11 +133,11 @@ module Models = struct
Lock
| _ ->
NoEffect )
| Typ.Procname.ObjC_Cpp _ as pname when is_cpp_lock pname actuals ->
| Typ.Procname.ObjC_Cpp _ | C _ as pname when is_cpp_lock pname actuals ->
Lock
| Typ.Procname.ObjC_Cpp _ as pname when is_cpp_unlock pname ->
| Typ.Procname.ObjC_Cpp _ | C _ as pname when is_cpp_unlock pname ->
Unlock
| Typ.Procname.ObjC_Cpp _ as pname when is_cpp_trylock pname ->
| Typ.Procname.ObjC_Cpp _ | C _ as pname when is_cpp_trylock pname ->
LockedIfTrue
| pname when Typ.Procname.equal pname BuiltinDecl.__set_locked_attribute ->
Lock
@ -198,9 +198,9 @@ module Models = struct
None
in
PatternMatch.supertype_find_map_opt tenv get_container_access_ typename
| Typ.Procname.ObjC_Cpp _ as pname when is_cpp_container_read pname ->
| Typ.Procname.ObjC_Cpp _ | C _ as pname when is_cpp_container_read pname ->
Some ContainerRead
| Typ.Procname.ObjC_Cpp _ as pname when is_cpp_container_write pname ->
| Typ.Procname.ObjC_Cpp _ | C _ as pname when is_cpp_container_write pname ->
Some ContainerWrite
| _ ->
None

Loading…
Cancel
Save