module Ast_c: sig
.. end
Guards for #if conditionals
*
* Having #if guards in the AST is useful for cpp-aware analyses, or to
* later add support for matching against #ifS.
*
* General #if guards are stored as a string in a Gif_str
constructor.
* A traversal of the syntax tree with a parsing function would transform
* these into the parsed Gif
form.
*
* NOTE that there is no actually guaranteee that a traversal will
* eliminate all Gif_str
constructors, since the parsing function may
* fail.
*
* See Parsing #if guards
to know why this design choice.
*
*
Author(s): Iago Abal
type
posl = int * int
type
virtual_position = Common.parse_info * int
type
parse_info =
| |
OriginTok of Common.parse_info |
| |
FakeTok of string * virtual_position |
| |
ExpandedTok of Common.parse_info * virtual_position |
| |
AbstractLineTok of Common.parse_info |
type
danger =
| |
DangerStart |
| |
DangerEnd |
| |
Danger |
| |
NoDanger |
type
info = {
}
type
il = info list
type 'a
wrap = 'a * il
type 'a
wrap2 = 'a * il
type 'a
wrap3 = 'a * il
type
name =
| |
RegularName of string wrap |
| |
CppConcatenatedName of string wrap wrap2 list |
| |
CppVariadicName of string wrap |
| |
CppIdentBuilder of string wrap * string wrap wrap2 list |
type
fullType = typeQualifier * typeC
type
typeC = typeCbis wrap
type
typeCbis =
type
baseType =
| |
Void |
| |
IntType of intType |
| |
FloatType of floatType |
| |
SizeType |
| |
SSizeType |
| |
PtrDiffType |
type
intType =
type
signed = sign * base
type
base =
| |
CChar2 |
| |
CShort |
| |
CInt |
| |
CLong |
| |
CLongLong |
type
sign =
type
floatType =
| |
CFloat |
| |
CDouble |
| |
CLongDouble |
type
structUnion =
type
structType = field list
type
field =
type
field_declaration =
type
fieldkind =
type
enumType = oneEnumType wrap2 list
type
oneEnumType = name * (info * constExpression) option
type
functionType = fullType * (parameterType wrap2 list * bool wrap)
type
parameterType = {
}
type
typeQualifier = typeQualifierbis wrap
type
typeQualifierbis = {
|
const : bool ; |
|
volatile : bool ; |
}
type
attribute = attributebis wrap
type
attributebis =
type
expression = (expressionbis * exp_info ref) wrap3
type
exp_info = exp_type option * test
type
exp_type = fullType * local
type
local =
type
test =
type
expressionbis =
type
argument = (expression, weird_argument) Common.either
type
weird_argument =
type
action_macro =
type
constant =
| |
String of (string * isWchar) |
| |
MultiString of string list |
| |
Char of (string * isWchar) |
| |
Int of (string * intType) |
| |
Float of (string * floatType) |
| |
DecimalConst of (string * string * string) |
type
isWchar =
type
unaryOp =
| |
GetRef |
| |
DeRef |
| |
UnPlus |
| |
UnMinus |
| |
Tilde |
| |
Not |
| |
GetRefLabel |
type
assignOpbis =
| |
SimpleAssign |
| |
OpAssign of arithOp |
type
assignOp = assignOpbis wrap
type
fixOp =
type
binaryOpbis =
type
binaryOp = binaryOpbis wrap
type
arithOp =
| |
Plus |
| |
Minus |
| |
Mul |
| |
Div |
| |
Mod |
| |
DecLeft |
| |
DecRight |
| |
And |
| |
Or |
| |
Xor |
| |
Max |
| |
Min |
type
logicalOp =
| |
Inf |
| |
Sup |
| |
InfEq |
| |
SupEq |
| |
Eq |
| |
NotEq |
| |
AndLog |
| |
OrLog |
type
constExpression = expression
type
string_fragment = string_fragment_bis wrap
type
string_fragment_bis =
type
string_format = string_format_bis wrap
type
string_format_bis =
| |
ConstantFormat of string |
type
statement = statementbis wrap3
type
statementbis =
type
labeled =
type
compound = statement_sequencable list
type
statement_sequencable =
type
exprStatement = expression option
type
declOrExpr =
type
selection =
type
iteration =
type
jump =
type
asmbody = il * colon wrap list
type
colon =
type
colon_option = colon_option_bis wrap
type
colon_option_bis =
type
exec_code_bis =
type
exec_code = exec_code_bis wrap
type
declaration =
type
onedecl = {
}
type
v_init =
type
storage = storagebis * bool
type
storagebis =
type
storageClass =
| |
Auto |
| |
Static |
| |
Register |
| |
Extern |
type
local_decl =
| |
LocalDecl |
| |
NotLocalDecl |
type
initialiser = initialiserbis wrap
type
initialiserbis =
type
designator = designatorbis wrap
type
designatorbis =
type
definition = definitionbis wrap
type
definitionbis = {
}
type
cpp_directive =
type
define = string wrap * (define_kind * define_val)
type
define_kind =
type
define_val =
type
includ = {
}
type
inc_file =
type
inc_elem = string
type
include_rel_pos = {
|
first_of : string list list ; |
|
last_of : string list list ; |
}
type
pragmainfo =
type
ifdef_directive =
type
ifdefkind =
type
ifdef_guard =
type
macro_symbol = string
type
matching_tag =
| |
IfdefTag of (int * int) |
type
toplevel =
type
program = toplevel list
type
metavars_binding = (Ast_cocci.meta_name, metavar_binding_kind) Common.assoc
type
metavar_binding_kind =
type
stripped =
| |
WITH_TYPES |
| |
WITHOUT_TYPES |
= {
}
type
comment_and_relative_pos = {
|
minfo : Common.parse_info ; |
|
mpos : int ; |
}
= Common.parse_info
type
com = comment list ref
val nullQualif : typeQualifierbis * 'a list
val nQ : typeQualifierbis * 'a list
val defaultInt : typeCbis
val noType : unit -> ('a option * test) ref
val noInstr : statementbis * 'a list
val noTypedefDef : unit -> 'a option
val emptyMetavarsBinding : metavars_binding
val emptyAnnotCocci : Ast_cocci.mcodekind * metavars_binding list
val emptyAnnot : (Ast_cocci.mcodekind * metavars_binding list) option
val mcode_and_env_of_cocciref : (Ast_cocci.mcodekind * metavars_binding list) option ref ->
Ast_cocci.mcodekind * metavars_binding list
: comments_around
val noRelPos : unit -> include_rel_pos option ref
val noInIfdef : unit -> bool ref
val no_virt_pos : Common.parse_info * int
val fakeInfo : 'a -> info
val noii : 'a list
val noattr : 'a list
val noi_content : (Common.filename * program) option
val unwrap : 'a * 'b -> 'a
val unwrap2 : 'a * 'b -> 'a
val unwrap_expr : ('a * 'b) * 'c -> 'a
Parameters: |
((unwrap_e,typ),iie) |
: |
('a * 'b) * 'c
|
|
val rewrap_expr : ('a * 'b) * 'c -> 'd -> ('d * 'b) * 'c
Parameters: |
((_old_unwrap_e,typ),iie) |
: |
('a * 'b) * 'c
|
newe |
: |
'd
|
|
val unwrap_typeC : 'a * ('b * 'c) -> 'b
Parameters: |
(qu,(typeC,ii)) |
: |
'a * ('b * 'c)
|
|
val rewrap_typeC : 'a * ('b * 'c) -> 'd -> 'a * ('d * 'c)
Parameters: |
(qu,(typeC,ii)) |
: |
'a * ('b * 'c)
|
newtypeC |
: |
'd
|
|
val unwrap_typeCbis : 'a * 'b -> 'a
val unwrap_st : 'a * 'b -> 'a
val mk_e : 'a -> 'b -> ('a * ('c option * test) ref) * 'b
val mk_e_bis : 'a -> 'b -> 'c -> ('a * 'b) * 'c
Parameters: |
unwrap_e |
: |
'a
|
ty |
: |
'b
|
ii |
: |
'c
|
|
val mk_ty : 'a -> 'b -> (typeQualifierbis * 'c list) * ('a * 'b)
val mk_tybis : 'a -> 'b -> 'a * 'b
val mk_st : 'a -> 'b -> 'a * 'b
val get_ii_typeC_take_care : 'a * 'b -> 'b
val get_ii_st_take_care : 'a * 'b -> 'b
val get_ii_expr_take_care : 'a * 'b -> 'b
val get_st_and_ii : 'a * 'b -> 'a * 'b
val get_ty_and_ii : 'a * ('b * 'c) -> 'a * ('b * 'c)
Parameters: |
(qu,(typeC,ii)) |
: |
'a * ('b * 'c)
|
|
val get_e_and_ii : 'a * 'b -> 'a * 'b
val get_type_expr : ('a * 'b ref) * 'c -> 'b
Parameters: |
((unwrap_e,typ),iie) |
: |
('a * 'b ref) * 'c
|
|
val set_type_expr : ('a * 'b ref) * 'c -> 'b -> unit
Parameters: |
((unwrap_e,oldtyp),iie) |
: |
('a * 'b ref) * 'c
|
newtyp |
: |
'b
|
|
val get_onlytype_expr : ('a * (('b * 'c) option * 'd) ref) * 'e -> 'b option
Parameters: |
((unwrap_e,typ),iie) |
: |
('a * (('b * 'c) option * 'd) ref) * 'e
|
|
val get_onlylocal_expr : ('a * (('b * 'c) option * 'd) ref) * 'e -> 'c option
Parameters: |
((unwrap_e,typ),iie) |
: |
('a * (('b * 'c) option * 'd) ref) * 'e
|
|
val rewrap_str : string -> info -> info
val rewrap_pinfo : parse_info -> info -> info
val get_pi : parse_info -> Common.parse_info
val get_opi : parse_info -> Common.parse_info
val str_of_info : info -> string
val get_info : (Common.parse_info -> 'a) -> info -> 'a
Parameters: |
f |
: |
Common.parse_info -> 'a
|
ii |
: |
info
|
|
val get_orig_info : (Common.parse_info -> 'a) -> info -> 'a
Parameters: |
f |
: |
Common.parse_info -> 'a
|
ii |
: |
info
|
|
val make_expanded : info -> info
val pos_of_info : info -> int
val opos_of_info : info -> int
val line_of_info : info -> int
val col_of_info : info -> int
val file_of_info : info -> Common.filename
val mcode_of_info : info -> Ast_cocci.mcodekind
val pinfo_of_info : info -> parse_info
val parse_info_of_info : info -> Common.parse_info
val strloc_of_info : info -> string
val is_fake : info -> bool
val is_origintok : info -> bool
type
posrv =
val compare_pos : info -> info -> int
val equal_posl : 'a * 'b -> 'a * 'b -> bool
Parameters: |
(l1,c1) |
: |
'a * 'b
|
(l2,c2) |
: |
'a * 'b
|
|
val compare_posl : int * int -> int * int -> int
Parameters: |
(l1,c1) |
: |
int * int
|
(l2,c2) |
: |
int * int
|
|
val info_to_fixpos : info -> Ast_cocci.fixpos
val is_test : expression -> bool
val al_info : int -> info -> info
Parameters: |
tokenindex |
: |
int
|
x |
: |
info
|
|
val semi_al_info : info -> info
val magic_real_number : int
val real_al_info : info -> info
: comments_around -> comments_around
val al_info_cpp : int -> info -> info
Parameters: |
tokenindex |
: |
int
|
x |
: |
info
|
|
val semi_al_info_cpp : info -> info
val real_al_info_cpp : info -> info
val s_of_inc_file : inc_file -> string
val s_of_inc_file_bis : inc_file -> string
val fieldname_of_fieldkind : fieldkind -> name option
val s_of_attr : (attributebis * 'a) list -> string
val str_of_name : name -> string
val get_s_and_ii_of_name : name -> string * il
val get_s_and_info_of_name : name -> string * info
val info_of_name : name -> info
val ii_of_name : name -> il
val get_local_ii_of_expr_inlining_ii_of_name : (expressionbis * 'a) * il -> il
val get_local_ii_of_tybis_inlining_ii_of_name : typeCbis * il -> il
val info_of_type : 'a * (typeCbis * il) -> parse_info option
val get_local_ii_of_st_inlining_ii_of_name : statementbis * info list -> info list
val name_of_parameter : parameterType -> string option
val put_annot_info : info -> Token_annot.annot_key -> Token_annot.annot_val -> unit
Parameters: |
info |
: |
info
|
key |
: |
Token_annot.annot_key
|
value |
: |
Token_annot.annot_val
|
|
val get_annot_info : info -> Token_annot.annot_key -> Token_annot.annot_val option
Parameters: |
info |
: |
info
|
key |
: |
Token_annot.annot_key
|
|
: info -> Token_c.comment_like_token list
: info -> Token_c.comment_like_token list
val string_of_toplevel : toplevel -> string
val string_of_inc_file : inc_file -> string