X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/9f8e26f459677a621822918b7539ae94214621ac..7f339edd551eefcd6c99f379ce91c27df997cfe3:/parsing_cocci/get_constants.ml diff --git a/parsing_cocci/get_constants.ml b/parsing_cocci/get_constants.ml index 5ceea90..95c1742 100644 --- a/parsing_cocci/get_constants.ml +++ b/parsing_cocci/get_constants.ml @@ -1,4 +1,8 @@ (* + * Copyright 2012, INRIA + * Julia Lawall, Gilles Muller + * Copyright 2010-2011, INRIA, University of Copenhagen + * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix * This file is part of Coccinelle. @@ -20,6 +24,7 @@ *) +# 0 "./get_constants.ml" (* get a list of all of the constants in the - slice of a SmPL file, to be used to select which files to process *) @@ -72,8 +77,8 @@ let get_minus_constants bind orbind = | Ast.DisjExpr(exps) -> disj_union_all (List.map r.V.combiner_expression exps) | Ast.Edots(_,_) | Ast.Ecircles(_,_) | Ast.Estars(_,_) -> [] - | Ast.NestExpr(expr_dots,whencode,false) -> [] - | Ast.NestExpr(expr_dots,whencode,true) -> + | Ast.NestExpr(starter,expr_dots,ender,whencode,false) -> [] + | Ast.NestExpr(starter,expr_dots,ender,whencode,true) -> r.V.combiner_expression_dots expr_dots | _ -> k e in @@ -112,8 +117,9 @@ let get_minus_constants bind orbind = Ast.Disj(stmt_dots) -> disj_union_all (List.map r.V.combiner_statement_dots stmt_dots) | Ast.Dots(d,whn,_,_) | Ast.Circles(d,whn,_,_) | Ast.Stars(d,whn,_,_) -> [] - | Ast.Nest(stmt_dots,whn,false,_,_) -> [] - | Ast.Nest(stmt_dots,whn,true,_,_) -> r.V.combiner_statement_dots stmt_dots + | Ast.Nest(starter,stmt_dots,ender,whn,false,_,_) -> [] + | Ast.Nest(starter,stmt_dots,ender,whn,true,_,_) -> + r.V.combiner_statement_dots stmt_dots | _ -> k e in V.combiner bind option_default @@ -196,7 +202,8 @@ let check_inherited nm = let rec type_collect res = function TC.ConstVol(_,ty) | TC.Pointer(ty) | TC.FunctionPointer(ty) | TC.Array(ty) -> type_collect res ty - | TC.MetaType(tyname,_,_) -> inherited tyname + | TC.MetaType(tyname,_,_) -> + inherited tyname | ty -> res in let strictexpr recursor k e = @@ -217,7 +224,9 @@ let check_inherited nm = let strictdecls recursor k d = match Ast.unwrap d with - Ast.DisjDecl(decls) -> option_default + Ast.MetaDecl(name,_,_) | Ast.MetaField(name,_,_) -> + bind (k p) (minherited name) + | Ast.DisjDecl(decls) -> option_default | _ -> k d in let strictfullType recursor k ty = @@ -303,7 +312,7 @@ let get_constants rules = function r -> match r with Ast.ScriptRule (_,_,_,_) - | Ast.InitialScriptRule (_,_) | Ast.FinalScriptRule (_,_) -> + | Ast.InitialScriptRule (_,_,_) | Ast.FinalScriptRule (_,_,_) -> (rest_info, in_plus) | Ast.CocciRule (nm, (dep,_,_), cur, _, _) -> let (cur_info,cur_plus) = rule_fn cur in_plus in