Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ec170644 authored by Thierry Martinez's avatar Thierry Martinez
Browse files

Use Clang.Ast.identifier_name

parent 08e2e5b3
No related branches found
No related tags found
No related merge requests found
Pipeline #86895 failed
......@@ -14,15 +14,11 @@ let fresh_var_name () =
fresh_var_counter := index + 1;
Printf.sprintf "__tmp_%d" index
let identifier_name name : Clang.Ast.ident_ref =
{ nested_name_specifier = None;
name = IdentifierName name }
let declare_tmp qual_type =
let tmp = fresh_var_name () in
let decl_tmp = Clang.Ast.node ~qual_type (Clang.Ast.Decl [
Clang.Ast.node ~qual_type (Clang.Ast.Var (Clang.Ast.var tmp qual_type))]) in
let tmp_var = Clang.Ast.node ~qual_type (Clang.Ast.DeclRef (identifier_name tmp)) in
let tmp_var = Clang.Ast.node ~qual_type (Clang.Ast.DeclRef (Clang.Ast.identifier_name tmp)) in
tmp_var, decl_tmp
let assign_to_tmp ?qual_type expr =
......@@ -101,7 +97,7 @@ let rec name_anonymous_fields (decl : Clang.Ast.decl list) =
desc = Clang.Ast.RecordDecl { record_decl with name = "anon" }} ::
{ field with desc = Field { name; bitwidth; init;
qual_type = { qual_type with desc = Elaborated { elaborated with
named_type = { named_type with desc = Record (identifier_name "anon") }}}}} ::
named_type = { named_type with desc = Record (Clang.Ast.identifier_name "anon") }}}}} ::
name_anonymous_fields tail
| hd :: tl -> hd :: name_anonymous_fields tl
......@@ -177,7 +173,7 @@ let transform = object (self)
Expr { stmt with desc = BinaryOperator {
lhs =
Clang.Ast.node ~qual_type:var_type
(Clang.Ast.DeclRef (identifier_name var_name));
(Clang.Ast.DeclRef (Clang.Ast.identifier_name var_name));
kind = Assign; rhs = init }}} in
close_stmts init_stmts [decl; init]
| { desc = Do { body; cond; _ }; _} ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment