From 72c4354395a78428d2a7539d5d5ecc5fda792369 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 15 Jul 2015 10:10:53 -0100 Subject: [PATCH] [clang] propagate parameters of sentinel attr to the backend Summary: Now that attribute arguments are exported by the clang plugin, use them in the case of sentinel attributes, which the backend knows about. --- infer/src/clang/cMethod_trans.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index a74200a0d..7b5a3f577 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -134,9 +134,11 @@ let sil_func_attributes_of_attributes attrs = let rec do_translation acc al = match al with | [] -> list_rev acc | Clang_ast_t.SentinelAttr attribute_info::tl -> - (* TODO(t7466561) right now the clang plugin does not emit attribute arguments *) - (* so we default to (0,0) --the default sentinel values. *) - do_translation (Sil.FA_sentinel(0,0)::acc) tl + let (sentinel, null_pos) = match attribute_info.Clang_ast_t.ai_parameters with + | a::b::[] -> (int_of_string a, int_of_string b) + | _ -> assert false + in + do_translation (Sil.FA_sentinel(sentinel, null_pos)::acc) tl | _::tl -> do_translation acc tl in do_translation [] attrs