Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clangml-transforms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
memcad
clangml-transforms
Commits
ec170644
Commit
ec170644
authored
5 years ago
by
Thierry Martinez
Browse files
Options
Downloads
Patches
Plain Diff
Use Clang.Ast.identifier_name
parent
08e2e5b3
No related branches found
No related tags found
No related merge requests found
Pipeline
#86895
failed
5 years ago
Stage: prepare
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clangml-transforms/for_memcad.ml
+3
-7
3 additions, 7 deletions
clangml-transforms/for_memcad.ml
with
3 additions
and
7 deletions
clangml-transforms/for_memcad.ml
+
3
−
7
View file @
ec170644
...
...
@@ -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
;
_
};
_
}
->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment