From ed2318e287c6edeeceed7e2a104195b08aa3e31a Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 4 Jul 2019 12:36:52 +0200 Subject: Added helper function for array types. The function determines whether the given type is an array type or not. --- cparser/Cutil.ml | 5 +++++ cparser/Cutil.mli | 2 ++ 2 files changed, 7 insertions(+) (limited to 'cparser') diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 7329767a..5ff58780 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -821,6 +821,11 @@ let is_composite_type env t = | TStruct _ | TUnion _ -> true | _ -> false +let is_array_type env t = + match unroll env t with + | TArray _ -> true + | _ -> false + let is_function_type env t = match unroll env t with | TFun _ -> true diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index 5a1e9af3..3777c321 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -166,6 +166,8 @@ val is_scalar_type : Env.t -> typ -> bool (* Is type integer, float or pointer? *) val is_composite_type : Env.t -> typ -> bool (* Is type a struct or union? *) +val is_array_type : Env.t -> typ -> bool + (* Is type a array type? *) val is_function_type : Env.t -> typ -> bool (* Is type a function type? (not pointer to function) *) val is_function_pointer_type : Env.t -> typ -> bool -- cgit