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
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
memcad
clangml-transforms
Commits
2dc63b2d
Verified
Commit
2dc63b2d
authored
1 year ago
by
Thierry Martinez
Browse files
Options
Downloads
Patches
Plain Diff
Expand `*e` into `tmp = e; *tmp`
parent
361be733
No related branches found
No related tags found
No related merge requests found
Pipeline
#891707
failed
1 year ago
Stage: snapshot
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clangml-transforms/for_memcad.ml
+23
-10
23 additions, 10 deletions
clangml-transforms/for_memcad.ml
with
23 additions
and
10 deletions
clangml-transforms/for_memcad.ml
+
23
−
10
View file @
2dc63b2d
...
@@ -178,6 +178,12 @@ module Applicative =
...
@@ -178,6 +178,12 @@ module Applicative =
let
(
+
)
=
plus_with_warning
let
(
+
)
=
plus_with_warning
end
)))
end
)))
let
rec
deref_decl
(
expr
:
Clang
.
Ast
.
expr
)
=
match
expr
.
desc
with
|
DeclRef
_
->
true
|
UnaryOperator
{
kind
=
Deref
;
operand
}
->
deref_decl
operand
|
_
->
false
module
rec
Visitor
:
Refl
.
Visit
.
VisitorS
module
rec
Visitor
:
Refl
.
Visit
.
VisitorS
with
type
'
a
Applicative
.
t
=
'
a
Applicative
.
t
=
struct
with
type
'
a
Applicative
.
t
=
'
a
Applicative
.
t
=
struct
module
Applicative
=
Applicative
module
Applicative
=
Applicative
...
@@ -328,9 +334,17 @@ with type 'a Applicative.t = 'a Applicative.t = struct
...
@@ -328,9 +334,17 @@ with type 'a Applicative.t = 'a Applicative.t = struct
match
kind
with
match
kind
with
|
LNot
->
{
env
with
in_condition
=
true
}
|
LNot
->
{
env
with
in_condition
=
true
}
|
_
->
{
env
with
in_condition
=
false
}
in
|
_
->
{
env
with
in_condition
=
false
}
in
let
operand
,
operand_value
=
let
operand
,
delayed_stmts
=
Visit
.
visit
[
%
refl
:
Clang
.
Ast
.
expr
]
[]
operand
operand_env
in
Visit
.
visit
[
%
refl
:
Clang
.
Ast
.
expr
]
[]
operand
operand_env
in
UnaryOperator
{
kind
;
operand
}
,
operand_value
let
operand
,
delayed_stmts
=
match
kind
with
|
Deref
when
not
(
deref_decl
operand
)
->
let
operand
,
stmts
=
assign_to_tmp
operand
in
let
delayed_stmts
=
Free_monoid
.
plus
delayed_stmts
(
Free_monoid
.
of_list
stmts
)
in
operand
,
delayed_stmts
|
_
->
operand
,
delayed_stmts
in
UnaryOperator
{
kind
;
operand
}
,
delayed_stmts
let
rec
visit_if
(
cond
:
Clang
.
Ast
.
expr
)
(
then_branch
:
Clang
.
Ast
.
stmt
)
let
rec
visit_if
(
cond
:
Clang
.
Ast
.
expr
)
(
then_branch
:
Clang
.
Ast
.
stmt
)
(
else_branch
:
Clang
.
Ast
.
stmt
option
)
env
(
else_branch
:
Clang
.
Ast
.
stmt
option
)
env
...
@@ -420,7 +434,7 @@ with type 'a Applicative.t = 'a Applicative.t = struct
...
@@ -420,7 +434,7 @@ with type 'a Applicative.t = 'a Applicative.t = struct
|
_
->
|
_
->
let
(
expr
:
Clang
.
Ast
.
expr
)
,
delayed_stmts
=
let
(
expr
:
Clang
.
Ast
.
expr
)
,
delayed_stmts
=
super
expr
{
env
with
statement_root
=
false
;
assign_rhs
=
false
}
in
super
expr
{
env
with
statement_root
=
false
;
assign_rhs
=
false
}
in
let
make_assign
expr
lhs
=
let
make_assign
(
expr
:
Clang
.
Ast
.
expr
)
(
lhs
:
Clang
.
Ast
.
expr
)
=
if
env
.
statement_root
then
if
env
.
statement_root
then
expr
,
delayed_stmts
expr
,
delayed_stmts
else
else
...
@@ -642,13 +656,12 @@ with type 'a Applicative.t = 'a Applicative.t = struct
...
@@ -642,13 +656,12 @@ with type 'a Applicative.t = 'a Applicative.t = struct
visit_unary_expr_size_of
argument
env
visit_unary_expr_size_of
argument
env
|
ArraySubscript
{
base
;
index
}
|
ArraySubscript
{
base
;
index
}
when
not
(
is_array
base
)
->
when
not
(
is_array
base
)
->
let
x'
:
Clang
.
Ast
.
expr_desc
=
UnaryOperator
{
let
operand
:
Clang
.
Ast
.
expr
=
kind
=
Deref
;
{
base
with
desc
=
BinaryOperator
{
operand
=
{
base
with
desc
=
BinaryOperator
{
lhs
=
base
;
lhs
=
base
;
kind
=
Add
;
kind
=
Add
;
rhs
=
index
;
}}
in
rhs
=
index
;
}}}
in
visit_unary_operator
env
Deref
operand
super
x'
env
|
_
->
super
x
env
|
_
->
super
x
env
end
end
|
Clang
.
Ast
.
Refl_decl_desc
->
|
Clang
.
Ast
.
Refl_decl_desc
->
...
...
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