From 2d97b5d1116e66ef5c7d793ed81d1810aaef1291 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Mon, 10 Oct 2016 06:33:22 -0700 Subject: [PATCH] [clang] Add the objc interface case to the function get_decl_from_typ_ptr Reviewed By: akotulski Differential Revision: D3995051 fbshipit-source-id: 0c26159 --- infer/src/clang/cFrontend_utils.ml | 4 ++-- infer/src/clang/cFrontend_utils.mli | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infer/src/clang/cFrontend_utils.ml b/infer/src/clang/cFrontend_utils.ml index e838089a4..eaa45e4c7 100644 --- a/infer/src/clang/cFrontend_utils.ml +++ b/infer/src/clang/cFrontend_utils.ml @@ -260,9 +260,9 @@ struct let get_decl_from_typ_ptr typ_ptr = let typ_opt = get_desugared_type typ_ptr in let typ = match typ_opt with Some t -> t | _ -> assert false in - (* it needs extending to handle objC types *) match typ with - | Clang_ast_t.RecordType (_, decl_ptr) -> get_decl decl_ptr + | Clang_ast_t.RecordType (_, decl_ptr) + | Clang_ast_t.ObjCInterfaceType (_, decl_ptr) -> get_decl decl_ptr | _ -> None (*TODO take the attributes into account too. To be done after we get the attribute's arguments. *) diff --git a/infer/src/clang/cFrontend_utils.mli b/infer/src/clang/cFrontend_utils.mli index 92bfeb245..b2dac8a18 100644 --- a/infer/src/clang/cFrontend_utils.mli +++ b/infer/src/clang/cFrontend_utils.mli @@ -88,8 +88,8 @@ sig See get_type for more info and restrictions *) val get_desugared_type : Clang_ast_t.type_ptr -> Clang_ast_t.c_type option - (** returns declaration of the type for certain types and crashes for others - NOTE: this function needs extending to handle objC types *) +(** returns declaration of the type for certain types + (RecordType, ObjCInterfaceType and None for others *) val get_decl_from_typ_ptr : Clang_ast_t.type_ptr -> Clang_ast_t.decl option (** returns string representation of type_ptr