Skip to content

Commit eec9fbb

Browse files
fabianbsfabianbs96
andauthored
Requiring C++20 (#800)
* Requiring C++20 * Start replacing enable_if with requires * Replace rest of enable_if with requires, except for AdjacencyList (see comment in file) * Replace void_t-based SFINAE by requires and concepts * minor * Conceptify rest of phasar * Fix clang dep scanning in CI and Dockerfile * Replace PSR_CONCEPT by concept * minor cleanup * Remove mentions of c++17 * adapt my mail-address in readme --------- Co-authored-by: Fabian Schiebel <fabian.schiebel@iem.fraunhofer.de> Co-authored-by: Fabian Schiebel <fabianbs@mail.upb.de> Co-authored-by: Fabian Schiebel <52407375+fabianbs96@users.noreply.github.com>
1 parent 24176aa commit eec9fbb

File tree

76 files changed

+791
-1268
lines changed

Some content is hidden

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

76 files changed

+791
-1268
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: true
1616
matrix:
1717
os: [ubuntu-24.04, ubuntu-24.04-arm]
18-
compiler: [ [clang++-19, clang-19, "clang-19 libclang-rt-19-dev"] ]
18+
compiler: [ [clang++-19, clang-19, "clang-19 libclang-rt-19-dev clang-tools-19"] ]
1919
build: [ Debug, Release, DebugLibdeps, DebugCov ]
2020
include:
2121
- build: Debug

BUILD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ When using CMake to compile PhASAR the following optional parameters can be used
7979
| **PHASAR_ENABLE_PAMM** : STRING | Enable the performance measurement mechanism ('Off', 'Core' or 'Full', default is Off) |
8080
| **PHASAR_ENABLE_PIC** : BOOL | Build Position-Independed Code (default is ON) |
8181
| **PHASAR_ENABLE_WARNINGS** : BOOL | Enable compiler warnings (default is ON) |
82-
| **CMAKE_CXX_STANDARD** : INT|Build phasar in C++17 or C++20 mode (default is 17)|
82+
| **CMAKE_CXX_STANDARD** : INT|Adapt the used C++ standard (minimum required is 20)|
8383

8484
You can use these parameters either directly or modify the installer-script `bootstrap.sh`
8585

BreakingChanges.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## development HEAD
44

5+
- Requiring C++20 instead of C++17
6+
- Type-traits and other templates that are specialized now use `requires` instead of `enable_if`, wherever possible. This may reduce the number of (defaulted) template parameters in some cases.
57
- The `AdjacencyList` struct now now has one more template argument to denote the intege-like `vertex_t` type. It is the second template argument (which previously was the EdgeType). The edge-type is now denoted by the *third* template argument.
68
- The `AdjacencyList` switches from using `llvm::NoneType` as empty-node marker to `psr::EmptyType` for forward-compatibility with LLVM-16 that removes `llvm::NoneType`.
79

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ if (DEFINED LLVM_MAIN_SRC_DIR)
2323
set(PHASAR_IN_TREE 1)
2424
endif()
2525

26+
set(PHASAR_VERSION 2510)
2627
if (NOT PHASAR_IN_TREE)
2728
project (phasar
2829
LANGUAGES C CXX
2930
DESCRIPTION "A LLVM-based static analysis framework."
30-
VERSION 2510
31+
VERSION ${PHASAR_VERSION}
3132
)
3233
endif ()
33-
set(PHASAR_VERSION ${PROJECT_VERSION})
3434

3535
# NOTE: When we require cmake >= 3.21, we can use PROJECT_IS_TOP_LEVEL instead
3636
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ARG baseimage="ubuntu:24.04"
2-
FROM "$baseimage" as build
2+
FROM "$baseimage" AS build
33

44
RUN --mount=type=bind,source=./utils/InstallAptDependencies.sh,target=/InstallAptDependencies.sh \
55
set -eux; \
6-
./InstallAptDependencies.sh --noninteractive tzdata clang-19 libclang-rt-19-dev
6+
./InstallAptDependencies.sh --noninteractive tzdata clang-19 libclang-rt-19-dev clang-tools-19
77

88
ENV CC=/usr/bin/clang-19 \
99
CXX=/usr/bin/clang++-19

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# PhASAR: A LLVM-based Static Analysis Framework
44

5-
[![C++ Standard](https://img.shields.io/badge/C++_Standard-C%2B%2B17-blue.svg?style=flat&logo=c%2B%2B)](https://isocpp.org/)
5+
[![C++ Standard](https://img.shields.io/badge/C++_Standard-C%2B%2B20-blue.svg?style=flat&logo=c%2B%2B)](https://isocpp.org/)
66
[![GitHub license](https://img.shields.io/badge/license-MIT-blueviolet.svg)](https://raw.githubusercontent.com/secure-software-engineering/phasar/master/LICENSE.txt)
77
[![GitHub Release](https://img.shields.io/github/v/release/secure-software-engineering/phasar?label=version)](https://github.com/secure-software-engineering/phasar/releases)
88

@@ -24,7 +24,7 @@ this README first.
2424
as well. -->
2525
Please also have a look on PhASAR's project directory and notice the project directory [examples](./examples/) as well as the custom tool `tools/example-tool/myphasartool.cpp`.
2626

27-
**NEW:** You can find PhASAR's API reference [here](https://secure-software-engineering.github.io/phasar/).
27+
You can find PhASAR's API reference [here](https://secure-software-engineering.github.io/phasar/).
2828

2929

3030
## Secure Software Engineering Group
@@ -34,20 +34,17 @@ PhASAR is primarily developed and maintained by the Secure Software Engineering
3434
PhASAR was initially developed by Philipp Dominik Schubert (@pdschubert)(<philipp.schubert@upb.de>).
3535

3636
Currently, PhASAR is maintained by
37-
- Fabian Schiebel (@fabianbs96)(<fabian.schiebel@iem.fraunhofer.de>)
37+
- Fabian Schiebel (@fabianbs96)(<fabian.schiebel@uni-paderborn.de>)
3838
- Sriteja Kummita (@sritejakv)
3939
- Lucas Briese (@jusito)
4040
- Martin Mory (@MMory)(<martin.mory@upb.de>)
4141
- *others*
4242

4343
## Required Version of the C++ Standard
4444

45-
PhASAR requires at least C++-17.
45+
**NEW**: PhASAR requires at least C++-20.
4646

47-
However, building in C++20 mode is supported. You may enable this setting the cmake variable `CMAKE_CXX_STANDARD` to `20`.
48-
Although phasar currently does not make use of C++-20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 earlier.
49-
50-
**NEW**: PhASAR supports C++20 modules as an experimental feature.
47+
PhASAR supports C++20 modules as an experimental feature.
5148

5249
## Currently Supported Version of LLVM
5350

cmake/phasar_macros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function(add_phasar_library name)
279279
EXPORT_NAME ${component_name}
280280
)
281281

282-
target_compile_features(${name} PUBLIC cxx_std_17)
282+
target_compile_features(${name} PUBLIC cxx_std_20)
283283

284284
set(install_module)
285285
if(PHASAR_LIB_MODULE_FILES)

examples/use-phasar-as-library/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 3.12)
22

33
project(PhasarExttoolTest)
44

5-
set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
6-
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
76
set(CMAKE_CXX_STANDARD_REQUIRED ON)
87
set(CMAKE_CXX_EXTENSIONS OFF)
98

examples/use-phasar-with-fetch-content/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 3.12)
22

33
project(PhasarExttoolTest)
44

5-
set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
6-
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
76
set(CMAKE_CXX_STANDARD_REQUIRED ON)
87
set(CMAKE_CXX_EXTENSIONS OFF)
98

include/phasar/ControlFlow/CFGBase.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ template <typename Derived> class CFGBase : public CRTPBase<Derived> {
139139

140140
template <typename ICF, typename Domain>
141141
// NOLINTNEXTLINE(readability-identifier-naming)
142-
PSR_CONCEPT is_cfg_v =
143-
is_crtp_base_of_v<CFGBase, ICF> &&
144-
std::is_same_v<typename ICF::n_t, typename Domain::n_t> &&
145-
std::is_same_v<typename ICF::f_t, typename Domain::f_t>;
142+
concept is_cfg_v = is_crtp_base_of_v<CFGBase, ICF> &&
143+
std::is_same_v<typename ICF::n_t, typename Domain::n_t> &&
144+
std::is_same_v<typename ICF::f_t, typename Domain::f_t>;
146145

147146
} // namespace psr
148147

0 commit comments

Comments
 (0)