Skip to content

Commit d45e143

Browse files
committed
Merge branch 'master' into variadic-call
2 parents 14db663 + cb98d54 commit d45e143

252 files changed

Lines changed: 4389 additions & 3443 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v6
29+
uses: actions/checkout@v7
3030

3131
- name: Setup LLVM
3232
if: matrix.language == 'cpp'

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v6
21+
uses: actions/checkout@v7
2222

2323
- name: Setup LLVM
2424
uses: ZhongRuoyu/setup-llvm@v0

.github/workflows/run-tests.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout code
29-
uses: actions/checkout@v6
29+
uses: actions/checkout@v7
3030

3131
- name: Setup LLVM
3232
uses: ZhongRuoyu/setup-llvm@v0
@@ -47,9 +47,3 @@ jobs:
4747
- name: Run unit tests
4848
run: ninja check
4949
working-directory: build
50-
51-
- name: Check benchmarks (don't run)
52-
run: ninja check-benchmarks
53-
working-directory: build
54-
env:
55-
SKIP_RUN: 1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# CMake
22
build/
3+
_buildconfig.py
34

45
# Cargo
56
target/
67
Cargo.lock
8+
rules/rustls/rustls.h
79

810
# Python
911
*.pyc

CMakeLists.txt

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ execute_process(
5050
)
5151
message(STATUS ${CLANG_OUTPUT})
5252

53+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate-buildconfig-py.cmake)
54+
generate_buildconfig_py("${CMAKE_CURRENT_SOURCE_DIR}/tests/lit/lit")
55+
5356
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/rust-toolchain.cmake)
5457
set(RUST_STAMP_FILE "${CMAKE_BINARY_DIR}/.rust-toolchain.stamp")
5558

@@ -129,28 +132,14 @@ add_custom_target("check-unit"
129132
USES_TERMINAL
130133
)
131134

132-
add_custom_target("check-benchmarks"
133-
COMMAND ${CMAKE_COMMAND} -E env
134-
"CC=${CMAKE_C_COMPILER}"
135-
"CXX=${CMAKE_CXX_COMPILER}"
136-
"python3"
137-
"${PROJECT_SOURCE_DIR}/tests/lit/lit.py"
138-
${LIT_FLAGS}
139-
"${PROJECT_SOURCE_DIR}/tests/benchmarks"
140-
DEPENDS cpp2rust libcc2rs
141-
USES_TERMINAL
142-
)
143-
144135
add_custom_target("check"
145136
DEPENDS check-libcc2rs check-libcc2rs-macros check-unit
146137
)
147138

148-
add_custom_target("check-all"
149-
DEPENDS check check-benchmarks
150-
)
151-
152139
set(RULES_IR_DIR "${CMAKE_BINARY_DIR}/rules")
153140

141+
set(RUSTLS_HEADER "${PROJECT_SOURCE_DIR}/rules/rustls/rustls.h")
142+
154143
file(GLOB rule_subdirs ${PROJECT_SOURCE_DIR}/rules/*)
155144
set(cpp_rules_ir_outputs)
156145
set(rust_rules_ir_outputs)
@@ -167,7 +156,7 @@ foreach(_rule_dir IN LISTS rule_subdirs)
167156
OUTPUT ${_out}
168157
COMMAND ${CMAKE_COMMAND} -E make_directory ${_out_dir}
169158
COMMAND $<TARGET_FILE:cpp-rule-preprocessor> --dir ${_rule_dir} --out ${_out}
170-
DEPENDS ${_srcs} ${PROJECT_SOURCE_DIR}/cpp2rust/cpp_rule_preprocessor.cpp
159+
DEPENDS ${_srcs} ${PROJECT_SOURCE_DIR}/cpp2rust/cpp_rule_preprocessor.cpp ${RUSTLS_HEADER}
171160
VERBATIM
172161
)
173162
list(APPEND cpp_rules_ir_outputs ${_out})
@@ -187,7 +176,7 @@ file(GLOB_RECURSE rule_preprocessor_sources
187176
${PROJECT_SOURCE_DIR}/rule-preprocessor/src/*.rs)
188177

189178
add_custom_command(
190-
OUTPUT ${rust_rules_ir_outputs}
179+
OUTPUT ${rust_rules_ir_outputs} ${RUSTLS_HEADER}
191180
COMMAND cargo +${RUST_STABLE_VERSION} build --release --manifest-path "${PROJECT_SOURCE_DIR}/rules/Cargo.toml"
192181
COMMAND ${CMAKE_COMMAND} -E env
193182
CARGO_TARGET_DIR=${CMAKE_BINARY_DIR}/target_preprocessor

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Then run:
118118
## Test Suite
119119

120120
```bash
121-
# Run all tests except benchmarks
121+
# Run all tests
122122
ninja check
123123

124124
# Run only the unit tests
@@ -127,12 +127,9 @@ ninja check-unit
127127
# Run libcc2rs unit tests
128128
ninja check-libcc2rs
129129

130-
# Run benchmarks (compile & execute)
130+
# Run libcc2rs-macros unit tests
131131
ninja check-benchmarks
132132

133-
# Check benchmark output without executing binaries
134-
SKIP_RUN=1 ninja check-benchmarks
135-
136133
# Regenerate expected output for unit tests after intentional changes
137134
REPLACE_EXPECTED=1 ninja check-unit
138135
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function(generate_buildconfig_py outdir)
2+
file(CONFIGURE
3+
OUTPUT "${outdir}/_buildconfig.py"
4+
CONTENT [[
5+
"""Generated by CMake, do not edit."""
6+
7+
from pathlib import Path
8+
9+
CXX = Path(r"@CMAKE_CXX_COMPILER@")
10+
CC = Path(r"@CMAKE_C_COMPILER@")
11+
]]
12+
ESCAPE_QUOTES
13+
@ONLY
14+
)
15+
endfunction()

cpp2rust/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ list(REMOVE_ITEM CORE_SOURCES
55
)
66

77
add_library(cpp2rust_core STATIC ${CORE_SOURCES})
8+
llvm_update_compile_flags(cpp2rust_core)
89

910
target_link_libraries(cpp2rust_core PUBLIC
1011
clangAST

0 commit comments

Comments
 (0)