From 9c578406a1a2723c03d77ef0b54796549c8752b7 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Fri, 23 Oct 2015 07:45:16 -0700 Subject: [PATCH] update clang plugin version Summary: public Update clang plugin version that has following changes: 1. Don't dump DeclContext as a part of BlockDecl 2. Add location information to C++ constructor initializers This diff is making infer compatible with these changes by 1. Making infer compile 2. Reading location information from c++ constructor initializers so we don't miss update to line number Reviewed By: dulmarod Differential Revision: D2575066 fb-gh-sync-id: 6dc594a --- facebook-clang-plugins | 2 +- infer/src/clang/ast_expressions.ml | 2 +- infer/src/clang/cAstProcessor.ml | 9 ++++++++- infer/src/clang/cMethod_trans.ml | 2 +- infer/src/clang/cTrans.ml | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/facebook-clang-plugins b/facebook-clang-plugins index 18f5835c3..0b1043f4c 160000 --- a/facebook-clang-plugins +++ b/facebook-clang-plugins @@ -1 +1 @@ -Subproject commit 18f5835c340db4a3ba64a652b0daa23c1981507e +Subproject commit 0b1043f4cf5bb34282a3ebe53f3fea3426f45201 diff --git a/infer/src/clang/ast_expressions.ml b/infer/src/clang/ast_expressions.ml index 0bd480c9c..dc807a253 100644 --- a/infer/src/clang/ast_expressions.ml +++ b/infer/src/clang/ast_expressions.ml @@ -665,7 +665,7 @@ let translate_block_enumerate block_name stmt_info stmt_list ei = | _ -> assert false in let open Clang_ast_t in match stmt_list with - | [s; BlockExpr (_, _, bei, BlockDecl (_, _, _, bdi)) as be] -> + | [s; BlockExpr (_, _, bei, BlockDecl (_, bdi)) as be] -> let block_decl, bv = make_block_decl be in let vars_to_register = get_name_pointers bdi.bdi_parameters in let translated_stmt, op = translate bdi.bdi_parameters s block_decl bei.ei_type_ptr in diff --git a/infer/src/clang/cAstProcessor.ml b/infer/src/clang/cAstProcessor.ml index 33a7158c9..697dda8df 100644 --- a/infer/src/clang/cAstProcessor.ml +++ b/infer/src/clang/cAstProcessor.ml @@ -222,6 +222,10 @@ end = struct end +let ctor_initializer_process_locs loc_composer ctor_init = + let range' = LocComposer.compose loc_composer ctor_init.Clang_ast_t.xci_source_range in + { ctor_init with Clang_ast_t.xci_source_range = range'} + (** Apply a location composer to the locations in a statement. *) let rec stmt_process_locs loc_composer stmt = let update (stmt_info, stmt_list) = @@ -265,7 +269,10 @@ and decl_process_locs loc_composer decl = (decl_info', name, tp, fdecl_info') in let get_updated_method_decl (decl_info', name, tp, fdecl_info, method_info) = let di', n', tp', fdi' = get_updated_fun_decl (decl_info', name, tp, fdecl_info) in - (di', n', tp', fdi', method_info) in + let ctor_init = method_info.xmdi_cxx_ctor_initializers in + let ctor_init' = IList.map (ctor_initializer_process_locs loc_composer) ctor_init in + let method_info' = { method_info with xmdi_cxx_ctor_initializers = ctor_init'} in + (di', n', tp', fdi', method_info') in match decl' with | FunctionDecl fun_info -> FunctionDecl (get_updated_fun_decl fun_info) | CXXMethodDecl meth_info -> CXXMethodDecl (get_updated_method_decl meth_info) diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index 0b2a2f794..da4ebe630 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -139,7 +139,7 @@ let method_signature_of_decl class_name_opt meth_decl block_data_opt = let ms = build_method_signature decl_info procname method_decl false is_generated in let extra_instrs = get_assume_not_null_calls ms mdi.omdi_parameters in ms, mdi.omdi_body, extra_instrs - | BlockDecl (decl_info, decl_list, decl_context_info, bdi), + | BlockDecl (decl_info, bdi), Some (outer_context, tp, procname, _), _ -> let func_decl = Block_decl_info (bdi, tp, outer_context) in let ms = build_method_signature decl_info procname func_decl true false in diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 7e086549f..903735e1c 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -1821,7 +1821,7 @@ struct let instr = Sil.Letderef (id, Sil.Lvar (Sil.mk_pvar cvar procname), typ, loc) in (id, instr) in match decl with - | Clang_ast_t.BlockDecl (decl_info, decl_list, decl_context_info, block_decl_info) -> + | Clang_ast_t.BlockDecl (decl_info, block_decl_info) -> let open CContext in let type_ptr = expr_info.Clang_ast_t.ei_type_ptr in let block_pname = CFrontend_utils.General_utils.mk_fresh_block_procname procname in