Skip to content

Allow building against LLVM17 and include python12 wheels #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/format-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '16'
clang-format-version: '17'
check-path: 'llvm-plugin'
8 changes: 4 additions & 4 deletions .github/workflows/lint-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install mypy diopter pytest
- name: run mypy
run: python -m mypy --strict
Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install black
- name: Check formating with black
run: python -m black --check python_src/
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install . flake8
- name: run flake8
run: python -m flake8 python_src
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install isort
- name: Check imports with isort
run: python -m isort --profile black --check python_src
3 changes: 2 additions & 1 deletion .github/workflows/test-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
catchpp:
strategy:
matrix:
version: [14,15,16]
version: [15,16,17]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -20,6 +20,7 @@ jobs:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
sudo apt remove clang-15 clang-14 clang-13 clang-12 llvm-15 llvm-14 llvm-13 llvm-12
sudo apt-get update
sudo apt-get install ninja-build catch2 clang-${{ matrix.version }} libclang-${{ matrix.version }}-dev libclang-cpp${{ matrix.version }}-dev
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ jobs:
pytest:
strategy:
matrix:
version: [14,15,16]
version: [15,16,17]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- name: build instrumenter
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
sudo apt remove clang-15 clang-14 clang-13 clang-12 llvm-15 llvm-14 llvm-13 llvm-12
sudo apt-get update
sudo apt-get install ninja-build catch2 clang-${{ matrix.version }} libclang-${{ matrix.version }}-dev libclang-cpp${{ matrix.version }}-dev
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ['--profile', 'black']
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v18.1.6
hooks:
- id: clang-format
args: ['--style=llvm']
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
rev: v0.10.0
hooks:
- id: shellcheck
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [diopter==0.0.26, pytest==7.2.0]
Expand Down
1 change: 1 addition & 0 deletions build_python_wheel_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sed -i "s~THIS_DIR~$(pwd)~g" setup.py

"/opt/python/cp310-cp310/bin/python" -m build -w -o wheelhouse
"/opt/python/cp311-cp311/bin/python" -m build -w -o wheelhouse
"/opt/python/cp312-cp312/bin/python" -m build -w -o wheelhouse


function repair_wheel {
Expand Down
2 changes: 1 addition & 1 deletion python_src/program_markers/instrumenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_instrumenter(
except: # noqa: E722
pass
if not clang:
for clang_path in ("clang-16", "clang-15", "clang-14"):
for clang_path in ("clang-17", "clang-16", "clang-15", "clang-14"):
try:
clang = CompilerExe.from_path(Path(clang_path))
break
Expand Down
6 changes: 3 additions & 3 deletions python_src/program_markers/iprogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def collect_markers(
current_marker_id += 1
new_markers.append(new_marker)
new_directive_emitters[new_marker] = directive_emitters[marker]
replacements[
(marker.macro_without_arguments(), marker.id)
] = new_marker.macro_without_arguments()
replacements[(marker.macro_without_arguments(), marker.id)] = (
new_marker.macro_without_arguments()
)
return tuple(new_markers), new_directive_emitters

new_programs = [programs[0]]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = program-markers
version = 0.5.5b
version = 0.5.5b1
author = Theodoros Theodoridis
author_email = [email protected]
description = Inserts markers in C/C++ code. Markers expose information about the optimizations a compiler has applied, e.g., whether a piece of code was dead code eliminated.
Expand Down
7 changes: 4 additions & 3 deletions src/ASTEdits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ void RuleActionEditCollector::run(
return;
}

#if CLANG_VERSION_MAJOR == 15 || CLANG_VERSION_MAJOR == 16
#if CLANG_VERSION_MAJOR == 15 || CLANG_VERSION_MAJOR == 16 || \
CLANG_VERSION_MAJOR == 17
Expected<SmallVector<transformer::Edit, 1>> Edits =
Rule.Cases[findSelectedCase(Result, Rule)].Edits(Result);
#elif CLANG_VERSION_MAJOR == 14
Expected<SmallVector<transformer::Edit, 1>> Edits =
findSelectedCase(Result, Rule).Edits(Result);
#else
#error "Only versions 14, 15, and 16 are supported"
#error "Only versions 14, 15, 16, and 17 are supported"
#endif

if (!Edits) {
Expand All @@ -54,7 +55,7 @@ void RuleActionEditCollector::run(
auto SM = Result.SourceManager;
for (const auto &T : *Edits) {
assert(T.Kind == transformer::EditKind::Range);
#if CLANG_VERSION_MAJOR == 16
#if CLANG_VERSION_MAJOR == 16 || CLANG_VERSION_MAJOR == 17
const auto *Metadata = T.Metadata.has_value()
? llvm::any_cast<EditMetadataKind>(&T.Metadata)
: nullptr;
Expand Down
Loading