Skip to content

Commit 2120d4b

Browse files
committed
[Claml] support llvm-15 & ocaml-5
1 parent ea23b9c commit 2120d4b

File tree

7 files changed

+19
-1939
lines changed

7 files changed

+19
-1939
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ src/declKind.ml
1111
src/attrKind.ml
1212
src/implicitCastKind.ml
1313
config
14+
test/dune
1415

1516
.vscode
1617
rewriter-test-runner

bootstrap.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
22

3-
SUPPORTED_LLVM_VERSION=("13" "12")
3+
SUPPORTED_LLVM_VERSION=("15" "13" "12")
44

55
find_llvm_config() {
66
LLVM_FOUND=0
7-
for v in ${SUPPORTED_LLVM_VERSION[@]}; do
8-
which llvm-config-$v >&/dev/null
7+
for LLVM_VERSION in ${SUPPORTED_LLVM_VERSION[@]}; do
8+
which llvm-config-$LLVM_VERSION >&/dev/null
99
if [[ $? == 0 ]]; then
10-
LLVM_CONFIG=llvm-config-$v
10+
LLVM_CONFIG=llvm-config-$LLVM_VERSION
1111
echo "$LLVM_CONFIG found"
1212
return 0
1313
fi
@@ -33,7 +33,7 @@ TYPE_NODES_FILE=$LLVM_HOME/include/clang/AST/TypeNodes.inc
3333

3434
HEADER="(* This file is automatically generated by bootstrap.sh *)"
3535

36-
LLVM_LIBS="-lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangARCMigrate -lclangRewrite -lclangEdit -lclangAST -lclangLex -lclangBasic"
36+
LLVM_LIBS="-lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangSupport -lclangAnalysis -lclangARCMigrate -lclangRewrite -lclangEdit -lclangAST -lclangLex -lclangBasic"
3737

3838
gen_config() {
3939
mkdir -p config
@@ -148,13 +148,14 @@ gen_implicit_cast_kind() {
148148

149149
gen_test() {
150150
TARGET=test/dune
151+
# https://ocaml.org/manual/4.14/instrumented-runtime.html#s:instr-runtime-enabling
151152
echo "(executable
152153
(name test)
153154
(modules test)
154155
(flags -runtime-variant d -g)
155156
(libraries claml))
156157
" >$TARGET
157-
for cfile in $(find test -maxdepth 1 -name "*.c"); do
158+
for cfile in $(find test -maxdepth 1 -name "*.c" | sort); do
158159
cfile=$(basename $cfile)
159160
echo "(rule
160161
(deps $cfile)
@@ -165,15 +166,15 @@ gen_test() {
165166
(pipe-stdout
166167
(ignore-stderr
167168
(run ./test.exe %{deps}))
168-
(run clang-format)))))
169+
(run clang-format-$LLVM_VERSION)))))
169170
170171
(rule
171172
(alias runtest)
172173
(action
173174
(diff ${cfile%%.*}.expected ${cfile%%.*}.output)))
174175
" >>$TARGET
175176
done
176-
177+
177178
sed -i '$d' $TARGET
178179
}
179180

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -e
55
export OPAMYES=1
66

77
NCPU="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)"
8-
OCAML_VERSION="4.13.1"
9-
CLAML_OPAM_SWITCH=claml-"$OCAML_VERSION"
8+
OCAML_VERSION="5.1.0"
9+
CLAML_OPAM_SWITCH=claml-"$OCAML_VERSION+flambda"
1010
opam init --compiler=$OCAML_VERSION -j $NCPU --no-setup
1111

1212
switch_exists=no

src/typeKind.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ type t =
88
| VariableArrayType
99
| AtomicType
1010
| AttributedType
11+
| BTFTagAttributedType
12+
| BitIntType
1113
| BlockPointerType
1214
| BuiltinType
1315
| ComplexType
1416
| DecltypeType
1517
| AutoType
1618
| DeducedTemplateSpecializationType
1719
| DependentAddressSpaceType
18-
| DependentExtIntType
20+
| DependentBitIntType
1921
| DependentNameType
2022
| DependentSizedExtVectorType
2123
| DependentTemplateSpecializationType
2224
| DependentVectorType
2325
| ElaboratedType
24-
| ExtIntType
2526
| FunctionNoProtoType
2627
| FunctionProtoType
2728
| InjectedClassNameType
@@ -50,6 +51,7 @@ type t =
5051
| TypedefType
5152
| UnaryTransformType
5253
| UnresolvedUsingType
54+
| UsingType
5355
| VectorType
5456
| ExtVectorType
5557
[@@deriving show]

test/attr-stmt0.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ int main() {
1111
int c = -1;
1212
switch (a) {
1313
case 0:
14-
__attribute__((fallthrough, );) case 1 : c = 0;
14+
__attribute__((fallthrough, );) case 1:
15+
c = 0;
1516
break;
1617
default:
1718
c = 1;

0 commit comments

Comments
 (0)