|
|
|
(*
|
|
|
|
* Copyright (c) 2013 - present Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*)
|
|
|
|
|
|
|
|
open! IStd
|
|
|
|
|
|
|
|
(** Methods for creating a procdesc from a method or function declaration
|
|
|
|
and for resolving a method call and finding the right callee *)
|
|
|
|
|
|
|
|
(** When the methoc call is MCStatic, means that it is a class method. When it is MCVirtual, it
|
|
|
|
means that it is an instance method and that the method to be called will be determined at
|
|
|
|
runtime. If it is MCNoVirtual it means that it is an instance method but that the method to be
|
|
|
|
called will be determined at compile time *)
|
|
|
|
type method_call_type = MCVirtual | MCNoVirtual | MCStatic [@@deriving compare]
|
|
|
|
|
|
|
|
val equal_method_call_type : method_call_type -> method_call_type -> bool
|
|
|
|
|
|
|
|
val create_local_procdesc :
|
|
|
|
?set_objc_accessor_attr:bool -> CFrontend_config.translation_unit_context -> Cfg.t -> Tenv.t
|
|
|
|
-> CMethodSignature.t -> Clang_ast_t.stmt list -> (Pvar.t * Typ.t) list -> bool
|
|
|
|
|
|
|
|
val create_external_procdesc :
|
|
|
|
Cfg.t -> Typ.Procname.t -> ProcAttributes.clang_method_kind -> (Typ.t * Typ.t list) option
|
|
|
|
-> unit
|
|
|
|
|
|
|
|
val get_objc_method_data :
|
|
|
|
Clang_ast_t.obj_c_message_expr_info -> string * Clang_ast_t.pointer option * method_call_type
|
Using clang's method resolution if possible
Summary: public
Using clang's method resolution. This means that, in method calls, clang gives you a pointer to the declaration of the method.
In some cases though, clang doesn't find the right method. For example, when it finds a method in a category, we
need to make it into a method in the corresponding class, because that's how we treat categories in Infer. Moreover,
when it finds a method in a protocol, that is not useful for us, since the implementation will be in some class. Finally,
sometimes the call is on an object of type id, in which case clang doesn't know what is the correct declaration. In
those cases, we fall back to what we were doing before of approximating the method resolution. We also refactor
some of the code.
Reviewed By: akotulski
Differential Revision: D2679766
fb-gh-sync-id: b79bb85
9 years ago
|
|
|
|
|
|
|
val get_class_name_method_call_from_receiver_kind :
|
|
|
|
CContext.t -> Clang_ast_t.obj_c_message_expr_info -> (Exp.t * Typ.t) list -> Typ.Name.t
|
Using clang's method resolution if possible
Summary: public
Using clang's method resolution. This means that, in method calls, clang gives you a pointer to the declaration of the method.
In some cases though, clang doesn't find the right method. For example, when it finds a method in a category, we
need to make it into a method in the corresponding class, because that's how we treat categories in Infer. Moreover,
when it finds a method in a protocol, that is not useful for us, since the implementation will be in some class. Finally,
sometimes the call is on an object of type id, in which case clang doesn't know what is the correct declaration. In
those cases, we fall back to what we were doing before of approximating the method resolution. We also refactor
some of the code.
Reviewed By: akotulski
Differential Revision: D2679766
fb-gh-sync-id: b79bb85
9 years ago
|
|
|
|
|
|
|
val get_class_name_method_call_from_clang :
|
|
|
|
CFrontend_config.translation_unit_context -> Tenv.t -> Clang_ast_t.obj_c_message_expr_info
|
|
|
|
-> Typ.Name.t option
|
|
|
|
|
|
|
|
val method_signature_of_pointer :
|
|
|
|
CFrontend_config.translation_unit_context -> Tenv.t -> Clang_ast_t.pointer
|
|
|
|
-> CMethodSignature.t option
|
|
|
|
|
|
|
|
val get_method_name_from_clang : Tenv.t -> CMethodSignature.t option -> Typ.Procname.t option
|
Using clang's method resolution if possible
Summary: public
Using clang's method resolution. This means that, in method calls, clang gives you a pointer to the declaration of the method.
In some cases though, clang doesn't find the right method. For example, when it finds a method in a category, we
need to make it into a method in the corresponding class, because that's how we treat categories in Infer. Moreover,
when it finds a method in a protocol, that is not useful for us, since the implementation will be in some class. Finally,
sometimes the call is on an object of type id, in which case clang doesn't know what is the correct declaration. In
those cases, we fall back to what we were doing before of approximating the method resolution. We also refactor
some of the code.
Reviewed By: akotulski
Differential Revision: D2679766
fb-gh-sync-id: b79bb85
9 years ago
|
|
|
|
|
|
|
val create_procdesc_with_pointer :
|
|
|
|
CContext.t -> Clang_ast_t.pointer -> Typ.Name.t option -> string -> Typ.Procname.t
|
|
|
|
|
|
|
|
val get_procname_from_cpp_lambda : CContext.t -> Clang_ast_t.decl -> Typ.Procname.t
|
|
|
|
|
|
|
|
val get_captures_from_cpp_lambda : Clang_ast_t.decl -> Clang_ast_t.lambda_capture_info list
|