Skip to content

Commit e36fa54

Browse files
committed
Merge branch 'development' into master_github
2 parents 388135d + af4916c commit e36fa54

101 files changed

Lines changed: 2912 additions & 2738 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Checks: '-*,
1616
-readability-convert-member-functions-to-static,
1717
-readability-isolate-declaration,
1818
cppcoreguidelines-*,
19+
-cppcoreguidelines-avoid-non-const-global-variables,
1920
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
2021
-cppcoreguidelines-owning-memory,
2122
-cppcoreguidelines-pro-type-reinterpret-cast,
@@ -53,6 +54,8 @@ CheckOptions:
5354
value: (c|d|d1|d2|d3|d4|d5|d5_restoredCtx|eP|f|f3|f4|f5|fCalleeSummary|g|n|dPrime|fPrime)
5455
- key: readability-identifier-naming.ParameterIgnoredRegexp
5556
value: (d|d1|d2|d3|d4|d5|eP|f|n)
57+
- key: readability-identifier-naming.FunctionIgnoredRegexp
58+
value: (try_emplace|from_json|to_json)
5659
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
5760
value: 1
5861
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions

external/json

Submodule json updated 627 files

include/phasar/Controller/AnalysisController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "phasar/DB/ProjectIRDB.h"
2121
#include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.h"
2222
#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h"
23+
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h"
2324
#include "phasar/PhasarLLVM/Pointer/LLVMBasedPointsToAnalysis.h"
2425
#include "phasar/PhasarLLVM/Pointer/LLVMPointsToSet.h"
2526
#include "phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h"
@@ -62,6 +63,7 @@ class AnalysisController {
6263
std::string ProjectID;
6364
std::string OutDirectory;
6465
boost::filesystem::path ResultDirectory;
66+
IFDSIDESolverConfig SolverConfig;
6567
[[maybe_unused]] Soundness SoundnessLevel;
6668
[[maybe_unused]] bool AutoGlobalSupport;
6769

@@ -122,6 +124,7 @@ class AnalysisController {
122124
const std::set<std::string> &EntryPoints,
123125
AnalysisStrategy Strategy,
124126
AnalysisControllerEmitterOptions EmitterOptions,
127+
IFDSIDESolverConfig SolverConfig,
125128
const std::string &ProjectID = "default-phasar-project",
126129
const std::string &OutDirectory = "");
127130

include/phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h

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

2020
#include "phasar/DB/ProjectIRDB.h"
2121
#include "phasar/PhasarLLVM/AnalysisStrategy/AnalysisSetup.h"
22+
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h"
23+
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h"
2224

2325
namespace psr {
2426

@@ -51,7 +53,7 @@ class WholeProgramAnalysis {
5153
Solver DataFlowSolver;
5254

5355
public:
54-
WholeProgramAnalysis(ProjectIRDB &IRDB,
56+
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
5557
std::set<std::string> EntryPoints = {},
5658
PointerAnalysisTy *PointerInfo = nullptr,
5759
CallGraphAnalysisTy *CallGraph = nullptr,
@@ -70,12 +72,17 @@ class WholeProgramAnalysis {
7072
: std::unique_ptr<CallGraphAnalysisTy>(CallGraph)),
7173
EntryPoints(EntryPoints),
7274
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, EntryPoints),
73-
DataFlowSolver(ProblemDesc) {}
75+
DataFlowSolver(ProblemDesc) {
76+
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
77+
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
78+
}
79+
}
7480

7581
template <typename T = ProblemDescription,
7682
typename = typename std::enable_if_t<!std::is_same_v<
7783
typename T::ConfigurationTy, HasNoConfigurationType>>>
78-
WholeProgramAnalysis(ProjectIRDB &IRDB, ConfigurationTy *Config,
84+
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
85+
ConfigurationTy *Config,
7986
std::set<std::string> EntryPoints = {},
8087
PointerAnalysisTy *PointerInfo = nullptr,
8188
CallGraphAnalysisTy *CallGraph = nullptr,
@@ -95,12 +102,17 @@ class WholeProgramAnalysis {
95102
EntryPoints(EntryPoints), Config(Config),
96103
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, *Config,
97104
EntryPoints),
98-
DataFlowSolver(ProblemDesc) {}
105+
DataFlowSolver(ProblemDesc) {
106+
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
107+
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
108+
}
109+
}
99110

100111
template <typename T = ProblemDescription,
101112
typename = typename std::enable_if_t<!std::is_same_v<
102113
typename T::ConfigurationTy, HasNoConfigurationType>>>
103-
WholeProgramAnalysis(ProjectIRDB &IRDB, std::string ConfigPath,
114+
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
115+
std::string ConfigPath,
104116
std::set<std::string> EntryPoints = {},
105117
PointerAnalysisTy *PointerInfo = nullptr,
106118
CallGraphAnalysisTy *CallGraph = nullptr,
@@ -121,7 +133,11 @@ class WholeProgramAnalysis {
121133
OwnsConfig(true), ConfigPath(ConfigPath),
122134
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, *Config,
123135
EntryPoints),
124-
DataFlowSolver(ProblemDesc) {}
136+
DataFlowSolver(ProblemDesc) {
137+
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
138+
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
139+
}
140+
}
125141

126142
WholeProgramAnalysis(const WholeProgramAnalysis &) = delete;
127143
WholeProgramAnalysis(WholeProgramAnalysis &&) = delete;

include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ class LLVMBasedICFG
321321

322322
template <typename Fn> void forEachGlobalCtor(Fn &&F) const {
323323
for (auto [Prio, Fun] : GlobalCtors) {
324-
F(static_cast<const llvm::Function *>(Fun));
324+
std::invoke(F, static_cast<const llvm::Function *>(Fun));
325325
}
326326
}
327327

328328
template <typename Fn> void forEachGlobalDtor(Fn &&F) const {
329329
for (auto [Prio, Fun] : GlobalDtors) {
330-
F(static_cast<const llvm::Function *>(Fun));
330+
std::invoke(F, static_cast<const llvm::Function *>(Fun));
331331
}
332332
}
333333

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class GenIf : public FlowFunction<D, Container> {
185185
: GenValues({GenValue}), Predicate(std::move(Predicate)) {}
186186

187187
GenIf(container_type GenValues, std::function<bool(D)> Predicate)
188-
: GenValues(std::move(GenValues)), Predicate(Predicate) {}
188+
: GenValues(std::move(GenValues)), Predicate(std::move(Predicate)) {}
189189

190190
~GenIf() override = default;
191191

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "phasar/Config/Configuration.h"
2323
#include "phasar/Utils/EnumFlags.h"
2424
#include "phasar/Utils/Logger.h"
25-
#include "phasar/Utils/Utilities.h"
2625

2726
namespace psr {
2827

@@ -39,13 +38,14 @@ enum class SolverConfigOptions : uint32_t {
3938
};
4039

4140
struct IFDSIDESolverConfig {
42-
IFDSIDESolverConfig();
43-
IFDSIDESolverConfig(SolverConfigOptions Options);
41+
IFDSIDESolverConfig() noexcept = default;
42+
IFDSIDESolverConfig(SolverConfigOptions Options) noexcept;
4443
~IFDSIDESolverConfig() = default;
45-
IFDSIDESolverConfig(const IFDSIDESolverConfig &) = default;
46-
IFDSIDESolverConfig &operator=(const IFDSIDESolverConfig &) = default;
47-
IFDSIDESolverConfig(IFDSIDESolverConfig &&) = default;
48-
IFDSIDESolverConfig &operator=(IFDSIDESolverConfig &&) = default;
44+
IFDSIDESolverConfig(const IFDSIDESolverConfig &) noexcept = default;
45+
IFDSIDESolverConfig &
46+
operator=(const IFDSIDESolverConfig &) noexcept = default;
47+
IFDSIDESolverConfig(IFDSIDESolverConfig &&) noexcept = default;
48+
IFDSIDESolverConfig &operator=(IFDSIDESolverConfig &&) noexcept = default;
4949

5050
[[nodiscard]] bool followReturnsPastSeeds() const;
5151
[[nodiscard]] bool autoAddZero() const;
@@ -61,6 +61,8 @@ struct IFDSIDESolverConfig {
6161
void setEmitESG(bool Set = true);
6262
void setComputePersistedSummaries(bool Set = true);
6363

64+
void setConfig(SolverConfigOptions Opt);
65+
6466
friend std::ostream &operator<<(std::ostream &OS,
6567
const IFDSIDESolverConfig &SC);
6668

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,8 @@ class LLVMZeroValue : public llvm::GlobalVariable {
6868
return LLVMZeroValueInternalName;
6969
}
7070

71-
bool isLLVMZeroValue(const llvm::Value *V) const {
72-
if (V && V->hasName()) {
73-
// checks if V's name start with "zero_value"
74-
return V->getName().find(LLVMZeroValueInternalName) !=
75-
llvm::StringRef::npos;
76-
}
77-
return false;
71+
static bool isLLVMZeroValue(const llvm::Value *V) {
72+
return V == getInstance();
7873
}
7974

8075
// Do not specify a destructor (at all)!

0 commit comments

Comments
 (0)