Skip to content
Snippets Groups Projects
Commit a365284a authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[convert] fix order of declaration for implicit members.

it seems that this is not consistent across clang versions.
parent 1e8b2d2a
No related branches found
No related tags found
No related merge requests found
Showing with 93 additions and 30 deletions
...@@ -2710,8 +2710,71 @@ let extract_decl = function ...@@ -2710,8 +2710,71 @@ let extract_decl = function
has_further_definition,None,None) has_further_definition,None,None)
| c -> c | c -> c
let implicit_kind = function
| CMethod(_,_,kind,_,args,_,_,_,_,_,_,_) ->
(match kind, args with
| FKConstructor false, [_] -> 1 (* default constructor, plain. *)
| FKConstructor true, [_] -> 2 (* default constructor, derived. *)
| FKConstructor false,
[_; { arg_type = { plain_type = LVReference _; qualifier }}]
when List.mem Const qualifier -> 3 (* copy constructor, const, plain. *)
| FKConstructor false,
[_; { arg_type = { plain_type = LVReference _; }}] ->
(* copy constructor, non-const, plain. *)
4
| FKConstructor true,
[_; { arg_type = { plain_type = LVReference _; qualifier }}]
when List.mem Const qualifier -> 5 (* copy constructor, const,derived. *)
| FKConstructor true,
[_; { arg_type = { plain_type = LVReference _; }}] ->
(* copy constructor, non-const, derived. *)
6
| FKConstructor false,
[_; { arg_type = { plain_type = RVReference _; qualifier }}]
when List.mem Const qualifier -> 7 (* move constructor, const, plain. *)
| FKConstructor false,
[_; { arg_type = { plain_type = RVReference _; }}] ->
(* move constructor, non-const, plain. *)
8
| FKConstructor true,
[_; { arg_type = { plain_type = RVReference _; qualifier }}]
when List.mem Const qualifier -> 9 (* move constructor, const,derived. *)
| FKConstructor true,
[_; { arg_type = { plain_type = RVReference _; }}] ->
(* move constructor, non-const, derived. *)
10
| FKMethod _,
[ _; { arg_type = { plain_type = (Struct _ | Union _); qualifier } }]
when List.mem Const qualifier -> 11 (*assign operator, const *)
| FKMethod _,
[ _; { arg_type = { plain_type = (Struct _ | Union _); } }] ->
12 (*assign operator, non const *)
| FKMethod _,
[ _; { arg_type = { plain_type = LVReference _; qualifier } }]
when List.mem Const qualifier -> 13 (* assign operator, const *)
| FKMethod _,
[ _; { arg_type = { plain_type = LVReference _; } }] ->
14 (* assign operator, non-const *)
| FKMethod _,
[ _; { arg_type = { plain_type = RVReference _; qualifier } }]
when List.mem Const qualifier -> 15 (* move operator, const *)
| FKMethod _,
[ _; { arg_type = { plain_type = RVReference _; } }] ->
16 (* move operator, non-const *)
| FKDestructor false, [ _ ] -> 17 (* destructor, plain. *)
| FKDestructor true, [ _ ] -> 18 (* destructor, derived. *)
| _ -> 0 (* unknown implicit operator, don't try to sort it. *)
)
| _ -> 0 (* unknown declaration, don't try to sort it. *)
let cmp_implicit i1 i2 =
let n1 = implicit_kind i1 in
let n2 = implicit_kind i2 in
compare n1 n2
let reorder_implicit l = let reorder_implicit l =
let implicit = Extlib.filter_map is_implicit_func extract_decl l in let implicit = Extlib.filter_map is_implicit_func extract_decl l in
let implicit = List.stable_sort cmp_implicit implicit in
implicit @ l implicit @ l
let iter_on_array ?(incr=true) env idx length mk_body = let iter_on_array ?(incr=true) env idx length mk_body =
......
...@@ -35,10 +35,10 @@ struct Bar { ...@@ -35,10 +35,10 @@ struct Bar {
}; };
void Foo::Ctor(struct Foo const *this); void Foo::Ctor(struct Foo const *this);
void Foo::Dtor(struct Foo const *this);
struct Foo *operator=(struct Foo *this, struct Foo *__frama_c_arg_0); struct Foo *operator=(struct Foo *this, struct Foo *__frama_c_arg_0);
void Foo::Dtor(struct Foo const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -33,10 +33,10 @@ struct Bar { ...@@ -33,10 +33,10 @@ struct Bar {
static int g = 0; static int g = 0;
void f(int i); void f(int i);
void Foo::Dtor(struct Foo const *this);
void Foo::Ctor(struct Foo const *this); void Foo::Ctor(struct Foo const *this);
void Foo::Dtor(struct Foo const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
...@@ -289,10 +289,10 @@ struct _frama_c_vmt _frama_c_vmt_header = ...@@ -289,10 +289,10 @@ struct _frama_c_vmt _frama_c_vmt_header =
{.table = _frama_c_vmt, {.table = _frama_c_vmt,
.table_size = 1, .table_size = 1,
.rtti_info = & _frama_c_rtti_name_info}; .rtti_info = & _frama_c_rtti_name_info};
void Bar::Dtor(struct Bar const *this);
void Bar::Ctor(struct Bar const *this); void Bar::Ctor(struct Bar const *this);
void Bar::Dtor(struct Bar const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -31,10 +31,10 @@ struct Bar { ...@@ -31,10 +31,10 @@ struct Bar {
struct Foo _frama_c__Z3Foo ; struct Foo _frama_c__Z3Foo ;
}; };
static int g = 0; static int g = 0;
void Foo::Dtor(struct Foo const *this);
void Foo::Ctor(struct Foo const *this); void Foo::Ctor(struct Foo const *this);
void Foo::Dtor(struct Foo const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
...@@ -287,10 +287,10 @@ struct _frama_c_vmt _frama_c_vmt_header = ...@@ -287,10 +287,10 @@ struct _frama_c_vmt _frama_c_vmt_header =
{.table = _frama_c_vmt, {.table = _frama_c_vmt,
.table_size = 1, .table_size = 1,
.rtti_info = & _frama_c_rtti_name_info}; .rtti_info = & _frama_c_rtti_name_info};
void Bar::Dtor(struct Bar const *this);
void Bar::Ctor(struct Bar const *this); void Bar::Ctor(struct Bar const *this);
void Bar::Dtor(struct Bar const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -26,10 +26,10 @@ struct Foo; ...@@ -26,10 +26,10 @@ struct Foo;
struct Foo { struct Foo {
int x ; int x ;
}; };
void Foo::Dtor(struct Foo const *this);
struct Foo *operator=(struct Foo *this, struct Foo *__frama_c_arg_0); struct Foo *operator=(struct Foo *this, struct Foo *__frama_c_arg_0);
void Foo::Dtor(struct Foo const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -32,10 +32,10 @@ struct B { ...@@ -32,10 +32,10 @@ struct B {
struct A _frama_c__Z1A ; struct A _frama_c__Z1A ;
int y ; int y ;
}; };
void A::Dtor(struct A const *this);
void A::Ctor(struct A const *this); void A::Ctor(struct A const *this);
void A::Dtor(struct A const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -2217,11 +2217,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -2217,11 +2217,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void __bool_binop<int,std::__equal_to>::Ctor(struct __bool_binop<int,std::__equal_to> const *this); void __bool_binop<int,std::__equal_to>::Ctor(struct __bool_binop<int,std::__equal_to> const *this);
void __bool_binop<int,std::__equal_to>::Dtor(struct __bool_binop<int,std::__equal_to> const *this);
void __bool_binop<int,std::__equal_to>::Ctor(struct __bool_binop<int,std::__equal_to> const *this, void __bool_binop<int,std::__equal_to>::Ctor(struct __bool_binop<int,std::__equal_to> const *this,
struct __bool_binop<int,std::__equal_to> const *__frama_c_arg_0); struct __bool_binop<int,std::__equal_to> const *__frama_c_arg_0);
void __bool_binop<int,std::__equal_to>::Dtor(struct __bool_binop<int,std::__equal_to> const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -1979,11 +1979,11 @@ struct reference_wrapper<int*,<abst>> ref<int*,<abst>>(int (**t)(int )) ...@@ -1979,11 +1979,11 @@ struct reference_wrapper<int*,<abst>> ref<int*,<abst>>(int (**t)(int ))
void __binop<int,std::__minus>::Ctor(struct __binop<int,std::__minus> const *this); void __binop<int,std::__minus>::Ctor(struct __binop<int,std::__minus> const *this);
void __binop<int,std::__minus>::Dtor(struct __binop<int,std::__minus> const *this);
void __binop<int,std::__minus>::Ctor(struct __binop<int,std::__minus> const *this, void __binop<int,std::__minus>::Ctor(struct __binop<int,std::__minus> const *this,
struct __binop<int,std::__minus> *__frama_c_arg_0); struct __binop<int,std::__minus> *__frama_c_arg_0);
void __binop<int,std::__minus>::Dtor(struct __binop<int,std::__minus> const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
...@@ -2026,11 +2026,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -2026,11 +2026,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void __binop<int,std::__plus>::Ctor(struct __binop<int,std::__plus> const *this); void __binop<int,std::__plus>::Ctor(struct __binop<int,std::__plus> const *this);
void __binop<int,std::__plus>::Dtor(struct __binop<int,std::__plus> const *this);
void __binop<int,std::__plus>::Ctor(struct __binop<int,std::__plus> const *this, void __binop<int,std::__plus>::Ctor(struct __binop<int,std::__plus> const *this,
struct __binop<int,std::__plus> *__frama_c_arg_0); struct __binop<int,std::__plus> *__frama_c_arg_0);
void __binop<int,std::__plus>::Dtor(struct __binop<int,std::__plus> const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -321,14 +321,14 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -321,14 +321,14 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.base_classes = (struct _frama_c_rtti_name_info_content *)0, .base_classes = (struct _frama_c_rtti_name_info_content *)0,
.number_of_base_classes = 0, .number_of_base_classes = 0,
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Dtor void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Ctor
(struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this); (struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this);
void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Ctor void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Ctor
(struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this, (struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this,
struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *__frama_c_arg_0); struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *__frama_c_arg_0);
void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Ctor void iterator<std::random_access_iterator_tag,int,int,int*,int&>::Dtor
(struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this); (struct iterator<std::random_access_iterator_tag,int,int,int*,int&> const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
...@@ -365,11 +365,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -365,11 +365,11 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.base_classes = (struct _frama_c_rtti_name_info_content *)0, .base_classes = (struct _frama_c_rtti_name_info_content *)0,
.number_of_base_classes = 0, .number_of_base_classes = 0,
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void reverse_iterator<int*>::Dtor(struct reverse_iterator<int*> const *this);
void reverse_iterator<int*>::Ctor(struct reverse_iterator<int*> const *this, void reverse_iterator<int*>::Ctor(struct reverse_iterator<int*> const *this,
struct reverse_iterator<int*> const *__frama_c_arg_0); struct reverse_iterator<int*> const *__frama_c_arg_0);
void reverse_iterator<int*>::Dtor(struct reverse_iterator<int*> const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -1816,10 +1816,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -1816,10 +1816,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.base_classes = (struct _frama_c_rtti_name_info_content *)0, .base_classes = (struct _frama_c_rtti_name_info_content *)0,
.number_of_base_classes = 0, .number_of_base_classes = 0,
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
void __shared_ref_base::Ctor(struct __shared_ref_base const *this); void __shared_ref_base::Ctor(struct __shared_ref_base const *this);
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -1774,10 +1774,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -1774,10 +1774,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.base_classes = (struct _frama_c_rtti_name_info_content *)0, .base_classes = (struct _frama_c_rtti_name_info_content *)0,
.number_of_base_classes = 0, .number_of_base_classes = 0,
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
void __shared_ref_base::Ctor(struct __shared_ref_base const *this); void __shared_ref_base::Ctor(struct __shared_ref_base const *this);
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
...@@ -1780,10 +1780,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info = ...@@ -1780,10 +1780,10 @@ struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info =
.base_classes = (struct _frama_c_rtti_name_info_content *)0, .base_classes = (struct _frama_c_rtti_name_info_content *)0,
.number_of_base_classes = 0, .number_of_base_classes = 0,
.pvmt = (struct _frama_c_vmt *)0}; .pvmt = (struct _frama_c_vmt *)0};
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
void __shared_ref_base::Ctor(struct __shared_ref_base const *this); void __shared_ref_base::Ctor(struct __shared_ref_base const *this);
void __shared_ref_base::Dtor(struct __shared_ref_base const *this);
struct _frama_c_vmt _frama_c_vmt_header; struct _frama_c_vmt _frama_c_vmt_header;
struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info; struct _frama_c_rtti_name_info_node _frama_c_rtti_name_info;
......
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