Mentions légales du service

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

bootstrapped repository for commit a6a771dc

parent a5d7e4e1
No related branches found
No related tags found
No related merge requests found
Pipeline #218066 failed
# 2021-02-19, 4.4.0
# 2021-02-21, 4.4.0
- Support for Clang/LLVM 11.0.1, 11.1.0 and 12.0.0.
- Support for OCaml 4.12
- Support for OCaml 4.12.
- Fix integer overflow on 32-bit platforms.
# 2020-09-22, 4.3.0
......
......@@ -105,7 +105,7 @@ The module [`Clang.Ast`] includes in particular the module [`Clang__ast`]
which declares the algebraic data types that represent the AST.
The documentation of most of the nodes contains examples that can be used as references
for how syntactic constructions are parsed, and that are extracted with [`ocamlcodoc`]
and serve as unit tests with `dune runtest` (or, equivalently, `make tests`).
and serve as unit tests with `dune runtest` (or, equivalently, `make test`).
Moreover, the git branch [`norms`] contains the AST corresponding to the examples
automatically extracted from C++14, C++17, and C++20 norms.
......
......@@ -326,24 +326,28 @@ let int64_of_cxint ?(signed = true) cxint =
else
invalid_arg "int64_of_cxint"
let int_of_cxint_opt ?(signed = true) cxint =
let int_of_cxint_opt ?(signed = true) cxint : int option =
(* The result type is always signed, therefore the bit sign is lost when
storing an unsigned value. *)
let sign_bit = if signed then 0 else 1 in
let bits = get_bits ~signed cxint in
if bits <= (if signed then 32 else 31) then
if bits > Sys.int_size - sign_bit then
None
else
let result =
if signed then
ext_int_get_sext_value cxint
if bits <= 32 - sign_bit then
if signed then
ext_int_get_sext_value cxint
else
ext_int_get_zext_value cxint
else
ext_int_get_zext_value cxint in
let result =
if signed then
ext_int_get_sext_value64 cxint
else
ext_int_get_zext_value64 cxint in
Int64.to_int result in
Some result
else if bits <= Sys.int_size then
let result =
if signed then
ext_int_get_sext_value64 cxint
else
ext_int_get_zext_value64 cxint in
Some (Int64.to_int result)
else
None
let int_of_cxint ?(signed = true) cxint =
match int_of_cxint_opt ~signed cxint with
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment