Skip to content

Commit b1abb44

Browse files
authored
Merge branch 'development' into f-ClangTidyIdentifierRenameControlFlow
2 parents 0eddd67 + d9a7b3b commit b1abb44

149 files changed

Lines changed: 413 additions & 384 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.

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Checks: '-*,
1111
-readability-static-definition-in-anonymous-namespace,
1212
-readability-implicit-bool-conversion,
1313
-readability-magic-numbers,
14+
-readability-function-cognitive-complexity,
15+
-readability-convert-member-functions-to-static,
16+
-readability-isolate-declaration,
1417
cppcoreguidelines-*,
1518
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
1619
-cppcoreguidelines-owning-memory,
@@ -20,8 +23,10 @@ Checks: '-*,
2023
-cppcoreguidelines-init-variables,
2124
-cppcoreguidelines-macro-usage,
2225
bugprone-*,
26+
-bugprone-easily-swappable-parameters,
2327
modernize-*,
2428
-modernize-use-trailing-return-type,
29+
-modernize-pass-by-value,
2530
performance-*,
2631
clang-analyzer-*,
2732
'

CMakeLists.txt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ include(GNUInstallDirs)
2020
set_property(GLOBAL PROPERTY TARGET_MESSAGES OFF)
2121

2222
if (NOT CMAKE_BUILD_TYPE)
23-
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build mode ('Debug' or 'Release', default is 'Debug')" FORCE)
23+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build mode ('DebugSan' or 'Debug' or 'Release', default is 'Debug')" FORCE)
2424
endif ()
25-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
25+
26+
if(CMAKE_BUILD_TYPE STREQUAL "DebugSan")
27+
message(STATUS "Selected Debug Build with sanitizers")
28+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe -g -fno-omit-frame-pointer -fsanitize=address,undefined")
29+
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
30+
message(STATUS "Selected Debug Build")
2631
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe -g")
2732
else()
33+
message(STATUS "Selected Release Build")
2834
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe -march=native")
2935
endif()
3036

@@ -43,7 +49,6 @@ file(STRINGS ${PHASAR_SRC_DIR}/include/phasar/Config/Version.h VERSION_NUMBER_FI
4349
string(REPLACE " " ";" VERSION_NUMBER_FILE ${VERSION_NUMBER_FILE})
4450
list(GET VERSION_NUMBER_FILE 2 VERSION_NUMBER_PHASAR)
4551

46-
4752
include("phasar_macros")
4853

4954
option(PHASAR_BUILD_UNITTESTS "Build all tests (default is ON)" ON)
@@ -52,6 +57,8 @@ option(PHASAR_BUILD_OPENSSL_TS_UNITTESTS "Build OPENSSL typestate tests (require
5257

5358
option(PHASAR_BUILD_IR "Build IR test code (default is ON)" ON)
5459

60+
option(PHASAR_ENABLE_CLANG_TIDY_DURING_BUILD "Run clang-tidy during build (default is OFF)" OFF)
61+
5562
option(PHASAR_BUILD_DOC "Build documentation" OFF)
5663

5764
option(PHASAR_DEBUG_LIBDEPS "Debug internal library dependencies (private linkage)" OFF)
@@ -96,12 +103,10 @@ endif()
96103
configure_file(config.h.in config.h @ONLY)
97104
include_directories(${CMAKE_CURRENT_BINARY_DIR})
98105

99-
100106
include_directories(
101107
${PHASAR_SRC_DIR}/include
102108
)
103109

104-
105110
set(PHASAR_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/phasar)
106111

107112
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${PHASAR_INSTALL_LIBDIR})
@@ -122,6 +127,9 @@ find_package(Boost 1.65.1 COMPONENTS filesystem graph system program_options log
122127
#find_package(Boost 1.72.0 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED)
123128
include_directories(${Boost_INCLUDE_DIRS})
124129

130+
# Disable clang-tidy for the external projects
131+
set(CMAKE_CXX_CLANG_TIDY "")
132+
125133
# We need to work around the behavior of nlohmann_json_schema_validator and nlohmann_json here
126134
# The validator needs the json part, but if you include it, the library of nlohmann_json_schema_validator
127135
# is not installed, leading to linker error. But just including nlohmann_json is not sufficient, as
@@ -237,8 +245,17 @@ endif()
237245
add_subdirectory(external/WALi-OpenNWA)
238246
include_directories(external/WALi-OpenNWA/Source/wali/include)
239247

248+
# Set up clang-tidy to run during PhASAR's compilation to indicate code smells
249+
if (PHASAR_ENABLE_CLANG_TIDY_DURING_BUILD)
250+
message(STATUS "Enabled clang-tidy during build")
251+
set(CMAKE_CXX_CLANG_TIDY
252+
clang-tidy;
253+
-header-filter=include/phasar.*h$;
254+
# -warnings-as-errors=*;
255+
)
256+
endif ()
240257

241-
# Add the Phasar subdirectories
258+
# Add PhASAR's subdirectories
242259
add_subdirectory(include)
243260
add_subdirectory(lib)
244261

include/phasar/Config/Version.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
#define PHASAR_VERSION v0521
1+
#ifndef PHASAR_CONFIG_VERSION_H
2+
#define PHASAR_CONFIG_VERSION_H
3+
4+
#define PHASAR_VERSION v0521
5+
6+
#endif

include/phasar/Controller/AnalysisController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10-
#ifndef PHASAR_CONTROLLER_ANALYSIS_CONTROLLER_H_
11-
#define PHASAR_CONTROLLER_ANALYSIS_CONTROLLER_H_
10+
#ifndef PHASAR_CONTROLLER_ANALYSISCONTROLLER_H
11+
#define PHASAR_CONTROLLER_ANALYSISCONTROLLER_H
1212

1313
#include <iostream>
1414
#include <set>

include/phasar/PhasarClang/ClangController.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
#ifndef PHASAR_PHASARCLANG_CLANGCONTROLLER_H_
1111
#define PHASAR_PHASARCLANG_CLANGCONTROLLER_H_
1212

13-
namespace clang {
14-
namespace tooling {
13+
namespace clang::tooling {
1514
class CommonOptionsParser;
16-
}
17-
} // namespace clang
15+
} // namespace clang::tooling
1816

1917
namespace psr {
2018

include/phasar/PhasarLLVM/AnalysisStrategy/Strategies.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10-
#ifndef PHASAR_PHASARLLVM_ANALYSISSTRATEGY_STRATEGIES
11-
#define PHASAR_PHASARLLVM_ANALYSISSTRATEGY_STRATEGIES
10+
#ifndef PHASAR_PHASARLLVM_ANALYSISSTRATEGY_STRATEGIES_H
11+
#define PHASAR_PHASARLLVM_ANALYSISSTRATEGY_STRATEGIES_H
1212

1313
#include <iosfwd>
1414
#include <string>

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/DefaultSeeds.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Author: pdschbrt
1515
*/
1616

17-
#ifndef PHASAR_PHASARLLVM_IFDSIDE_DEFAULTSEEDS_H_
18-
#define PHASAR_PHASARLLVM_IFDSIDE_DEFAULTSEEDS_H_
17+
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_DEFAULTSEEDS_H
18+
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_DEFAULTSEEDS_H
1919

2020
#include <map>
2121
#include <set>

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFact.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10-
#ifndef PHASAR_PHASARLLVM_IFDSIDE_EDGEFACT_H_
11-
#define PHASAR_PHASARLLVM_IFDSIDE_EDGEFACT_H_
10+
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFACT_H_
11+
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFACT_H_
1212

1313
#include <iosfwd>
1414

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFactWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10-
#ifndef PHASAR_PHASARLLVM_IFDSIDE_EDGEFACTWRAPPER_H_
11-
#define PHASAR_PHASARLLVM_IFDSIDE_EDGEFACTWRAPPER_H_
10+
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFACTWRAPPER_H
11+
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFACTWRAPPER_H
1212

1313
#include <map>
1414
#include <memory>

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctionComposer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10-
#ifndef PHASAR_PHASARLLVM_IFDSIDE_EDGEFUNCTIONCOMPOSER_H
11-
#define PHASAR_PHASARLLVM_IFDSIDE_EDGEFUNCTIONCOMPOSER_H
10+
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONCOMPOSER_H
11+
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONCOMPOSER_H
1212

1313
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctions.h"
1414

0 commit comments

Comments
 (0)