Skip to content

Commit 827fc55

Browse files
author
Martin Mory
committed
Merge branch 'f-FixClangTidyIDEAnalyses' into f-ClangTidyFixIDESolver
2 parents 54b685c + e8f410f commit 827fc55

69 files changed

Lines changed: 1105 additions & 1135 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
@@ -5,6 +5,7 @@ Checks: '-*,
55
-misc-non-private-member-variables-in-classes,
66
-misc-no-recursion,
77
readability-*,
8+
-readability-function-cognitive-complexity,
89
-readability-else-after*,
910
-readability-simplify-boolean-expr,
1011
-readability-implicit-bool-cast,
@@ -48,6 +49,10 @@ CheckOptions:
4849
value: CamelCase
4950
- key: readability-identifier-naming.VariableCase
5051
value: CamelCase
52+
- key: readability-identifier-naming.VariableIgnoredRegexp
53+
value: (c|d|d1|d2|d3|d4|d5|d5_restoredCtx|eP|f|f3|f4|f5|fCalleeSummary|g|n|dPrime|fPrime)
54+
- key: readability-identifier-naming.ParameterIgnoredRegexp
55+
value: (d|d1|d2|d3|d4|d5|eP|f|n)
5156
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
5257
value: 1
5358
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include(GNUInstallDirs)
2020
set_property(GLOBAL PROPERTY TARGET_MESSAGES OFF)
2121

2222
if (NOT CMAKE_BUILD_TYPE)
23-
set(CMAKE_BUILD_TYPE "DebugSan" CACHE STRING "Build mode ('DebugSan' or 'Debug' or 'Release', default is 'DebugSan')" FORCE)
23+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build mode ('DebugSan' or 'Debug' or 'Release', default is 'Debug')" FORCE)
2424
endif ()
2525

2626
if(CMAKE_BUILD_TYPE STREQUAL "DebugSan")
@@ -57,6 +57,8 @@ option(PHASAR_BUILD_OPENSSL_TS_UNITTESTS "Build OPENSSL typestate tests (require
5757

5858
option(PHASAR_BUILD_IR "Build IR test code (default is ON)" ON)
5959

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

6264
option(PHASAR_DEBUG_LIBDEPS "Debug internal library dependencies (private linkage)" OFF)

include/phasar/Config/Configuration.h

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,54 @@ namespace psr {
3535
class PhasarConfig {
3636
public:
3737
/// Current Phasar version
38-
static std::string PhasarVersion() { return XSTR(PHASAR_VERSION); } // NOLINT
38+
// NOLINTNEXTLINE(readability-identifier-naming)
39+
static std::string PhasarVersion() { return XSTR(PHASAR_VERSION); }
3940

4041
/// Stores the label/ tag with which we annotate the LLVM IR.
41-
static std::string MetaDataKind() { return "psr.id"; } // NOLINT
42+
// NOLINTNEXTLINE(readability-identifier-naming)
43+
static std::string MetaDataKind() { return "psr.id"; }
4244

43-
static std::string ConfigurationDirectory() { // NOLINT
44-
return ConfigDir;
45-
}
45+
// NOLINTNEXTLINE(readability-identifier-naming)
46+
static std::string ConfigurationDirectory() { return ConfigDir; }
4647

4748
/// Specifies the directory in which Phasar is located.
48-
static std::string PhasarDirectory() { return PhasarDir; } // NOLINT
49+
// NOLINTNEXTLINE(readability-identifier-naming)
50+
static std::string PhasarDirectory() { return PhasarDir; }
4951

5052
/// Name of the file storing all standard header search paths used for
5153
/// compilation.
52-
static std::string HeaderSearchPathsFileName() { // NOLINT
54+
// NOLINTNEXTLINE(readability-identifier-naming)
55+
static std::string HeaderSearchPathsFileName() {
5356
return "standard_header_paths.conf";
5457
}
5558

5659
/// Name of the compile_commands.json file (in case we wish to rename)
57-
static std::string CompileCommandsJson() { // NOLINT
58-
return "compile_commands.json";
59-
}
60+
// NOLINTNEXTLINE(readability-identifier-naming)
61+
static std::string CompileCommandsJson() { return "compile_commands.json"; }
6062

6163
/// Default Source- and Sink-Functions path
62-
static std::string DefaultSourceSinkFunctionsPath() { // NOLINT
64+
// NOLINTNEXTLINE(readability-identifier-naming)
65+
static std::string DefaultSourceSinkFunctionsPath() {
6366
return std::string(PhasarDirectory() +
6467
"config/phasar-source-sink-function.json");
6568
}
6669

6770
// Variables to be used in JSON export format
6871
/// Identifier for call graph export
69-
static std::string JsonCallGraphID() { return "psr.cg"; } // NOLINT
72+
// NOLINTNEXTLINE(readability-identifier-naming)
73+
static std::string JsonCallGraphID() { return "psr.cg"; }
7074

7175
/// Identifier for type hierarchy graph export
72-
static std::string JsonTypeHierarchyID() { return "psr.th"; } // NOLINT
76+
// NOLINTNEXTLINE(readability-identifier-naming)
77+
static std::string JsonTypeHierarchyID() { return "psr.th"; }
7378

7479
/// Identifier for points-to graph export
75-
static std::string JsonPointsToGraphID() { return "psr.pt"; } // NOLINT
80+
// NOLINTNEXTLINE(readability-identifier-naming)
81+
static std::string JsonPointsToGraphID() { return "psr.pt"; }
7682

7783
/// Identifier for data-flow results export
78-
static std::string JsonDataFlowID() { return "psr.df"; } // NOLINT
84+
// NOLINTNEXTLINE(readability-identifier-naming)
85+
static std::string JsonDataFlowID() { return "psr.df"; }
7986

8087
static PhasarConfig &getPhasarConfig();
8188

@@ -94,16 +101,17 @@ class PhasarConfig {
94101
}
95102

96103
/// Variables map of the parsed command-line parameters
97-
static boost::program_options::variables_map &VariablesMap() { // NOLINT
104+
// NOLINTNEXTLINE(readability-identifier-naming)
105+
static boost::program_options::variables_map &VariablesMap() {
98106
static boost::program_options::variables_map VMap;
99107
return VMap;
100108
}
101109

102110
~PhasarConfig() = default;
103111
PhasarConfig(const PhasarConfig &) = delete;
112+
PhasarConfig operator=(const PhasarConfig &) = delete;
104113
PhasarConfig(PhasarConfig &&) = delete;
105-
PhasarConfig &operator=(const PhasarConfig &) = delete;
106-
PhasarConfig &operator=(PhasarConfig &&) = delete;
114+
PhasarConfig operator=(PhasarConfig &&) = delete;
107115

108116
private:
109117
PhasarConfig();

include/phasar/Controller/AnalysisController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ class AnalysisController {
128128
~AnalysisController() = default;
129129

130130
AnalysisController(const AnalysisController &) = delete;
131-
132131
AnalysisController(AnalysisController &&) = delete;
132+
AnalysisController &operator=(const AnalysisController &) = delete;
133+
AnalysisController &operator=(const AnalysisController &&) = delete;
133134

134135
AnalysisController &operator=(const AnalysisController &) = delete;
135136

include/phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ class WholeProgramAnalysis {
124124
DataFlowSolver(ProblemDesc) {}
125125

126126
WholeProgramAnalysis(const WholeProgramAnalysis &) = delete;
127-
128127
WholeProgramAnalysis(WholeProgramAnalysis &&) = delete;
128+
WholeProgramAnalysis &operator=(WholeProgramAnalysis &) = delete;
129+
WholeProgramAnalysis &operator=(WholeProgramAnalysis &&) = delete;
129130

130131
WholeProgramAnalysis &operator=(WholeProgramAnalysis &) = delete;
131132

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ template <typename N, typename D> class DefaultSeeds {
2828
static std::map<N, std::set<D>> make(std::vector<N> Nodes, D ZeroNode) {
2929
std::map<N, std::set<D>> Result;
3030
for (N Node : Nodes) {
31-
Result.insert(Node, {ZeroNode});
31+
Result.insert(std::move(Node), {ZeroNode});
3232
}
3333
return Result;
3434
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class KillMultiple : public FlowFunction<D, Container> {
274274
KillMultiple(std::set<D> KillValues) : KillValues(std::move(KillValues)) {}
275275
~KillMultiple() override = default;
276276
container_type computeTargets(D Source) override {
277-
if (KillValues.count(Source)) {
277+
if (KillValues.find(Source) != KillValues.end()) {
278278
return {};
279279
}
280280
return {Source};
@@ -295,6 +295,7 @@ class KillAll : public FlowFunction<D, Container> {
295295
container_type computeTargets(D /*Source*/) override {
296296
return container_type();
297297
}
298+
298299
static std::shared_ptr<KillAll<D>> getInstance() {
299300
static std::shared_ptr<KillAll> Instance =
300301
std::shared_ptr<KillAll>(new KillAll);
@@ -358,7 +359,7 @@ class Transfer : public FlowFunction<D, Container> {
358359
using typename FlowFunction<D, Container>::container_type;
359360

360361
Transfer(D ToValue, D FromValue) : ToValue(ToValue), FromValue(FromValue) {}
361-
virtual ~Transfer() = default;
362+
~Transfer() override = default;
362363
container_type computeTargets(D Source) override {
363364
if (Source == FromValue) {
364365
return {Source, ToValue};
@@ -389,6 +390,7 @@ class Union : public FlowFunction<D, Container> {
389390
}
390391
return FlowFuncs;
391392
}()) {}
393+
392394
~Union() override = default;
393395
container_type computeTargets(D Source) override {
394396
container_type Result;

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSFieldSensTaintAnalysis/Stats/TraceStats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TraceStats {
3535

3636
FunctionStats &getFunctionStats(const std::string &File);
3737
LineNumberStats &getLineNumberStats(const std::string &File,
38-
const std::string &Function);
38+
const std::string &FunctionName);
3939
FileStats Stats;
4040
};
4141

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class AutoKillTMPs : public FlowFunction<const llvm::Value *> {
4545
public:
4646
AutoKillTMPs(FlowFunctionPtrType FF, const llvm::Instruction *In)
4747
: Delegate(std::move(FF)), Inst(In) {}
48+
4849
~AutoKillTMPs() override = default;
4950

5051
container_type computeTargets(const llvm::Value *Source) override {
@@ -403,6 +404,7 @@ template <typename D> class StrongUpdateStore : public FlowFunction<D> {
403404
public:
404405
StrongUpdateStore(const llvm::StoreInst *S, std::function<bool(D)> P)
405406
: Store(S), Predicate(std::move(P)) {}
407+
406408
~StrongUpdateStore() override = default;
407409

408410
std::set<D> computeTargets(D Source) override {

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/AbstractMemoryLocationFactory.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,17 @@ class AbstractMemoryLocationFactoryBase {
8989
const llvm::DataLayout *DL = nullptr;
9090

9191
const detail::AbstractMemoryLocationImpl *
92-
getOrCreateImpl(const llvm::Value *V, llvm::SmallVectorImpl<ptrdiff_t> &&Offs,
92+
getOrCreateImpl(const llvm::Value *V, llvm::ArrayRef<ptrdiff_t> Offs,
9393
unsigned BOUND);
9494

9595
const detail::AbstractMemoryLocationImpl *
9696
getOrCreateImpl(const llvm::Value *V, unsigned BOUND);
9797

9898
const AbstractMemoryLocationImpl *createImpl(const llvm::Value *V,
9999
unsigned BOUND);
100+
100101
[[nodiscard]] const AbstractMemoryLocationImpl *getOrCreateZeroImpl() const;
102+
101103
const AbstractMemoryLocationImpl *
102104
withIndirectionOfImpl(const AbstractMemoryLocationImpl *AML,
103105
llvm::ArrayRef<ptrdiff_t> Ind);
@@ -160,6 +162,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
160162
unsigned BOUND) {
161163
return {createImpl(V, BOUND)};
162164
}
165+
163166
[[nodiscard]] AbstractMemoryLocation getOrCreateZero() const {
164167
return {getOrCreateZeroImpl()};
165168
}

0 commit comments

Comments
 (0)