|
16 | 16 |
|
17 | 17 | #include "phasar/DB/ProjectIRDB.h" |
18 | 18 | #include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.h" |
| 19 | +#include "phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h" |
19 | 20 | #include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h" |
20 | 21 | #include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h" |
| 22 | +#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h" |
| 23 | +#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IFDSSolver.h" |
| 24 | +#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/InterMonoSolver.h" |
| 25 | +#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/IntraMonoSolver.h" |
21 | 26 | #include "phasar/PhasarLLVM/Pointer/LLVMBasedPointsToAnalysis.h" |
22 | 27 | #include "phasar/PhasarLLVM/Pointer/LLVMPointsToSet.h" |
| 28 | +#include "phasar/PhasarLLVM/TaintConfig/TaintConfig.h" |
23 | 29 | #include "phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h" |
24 | 30 | #include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h" |
25 | 31 | #include "phasar/Utils/EnumFlags.h" |
@@ -51,7 +57,7 @@ class AnalysisController { |
51 | 57 | LLVMTypeHierarchy TH; |
52 | 58 | LLVMPointsToSet PT; |
53 | 59 | LLVMBasedICFG ICF; |
54 | | - std::vector<DataFlowAnalysisKind> DataFlowAnalyses; |
| 60 | + std::vector<DataFlowAnalysisType> DataFlowAnalyses; |
55 | 61 | std::vector<std::string> AnalysisConfigs; |
56 | 62 | std::set<std::string> EntryPoints; |
57 | 63 | [[maybe_unused]] AnalysisStrategy Strategy; |
@@ -81,6 +87,67 @@ class AnalysisController { |
81 | 87 |
|
82 | 88 | void emitRequestedHelperAnalysisResults(); |
83 | 89 |
|
| 90 | + void executeIFDSUninitVar(); |
| 91 | + void executeIFDSConst(); |
| 92 | + void executeIFDSTaint(); |
| 93 | + void executeIFDSType(); |
| 94 | + void executeIFDSSolverTest(); |
| 95 | + void executeIFDSLinearConst(); |
| 96 | + void executeIFDSFieldSensTaint(); |
| 97 | + void executeIDEXTaint(); |
| 98 | + void executeIDEOpenSSLTS(); |
| 99 | + void executeIDECSTDIOTS(); |
| 100 | + void executeIDELinearConst(); |
| 101 | + void executeIDESolverTest(); |
| 102 | + void executeIDEIIA(); |
| 103 | + void executeIntraMonoFullConstant(); |
| 104 | + void executeIntraMonoSolverTest(); |
| 105 | + void executeInterMonoSolverTest(); |
| 106 | + void executeInterMonoTaint(); |
| 107 | + |
| 108 | + template <typename AnalysisTy, bool WithConfig = false> |
| 109 | + void executeIntraMonoAnalysis() { |
| 110 | + executeAnalysis<IntraMonoSolver_P<AnalysisTy>, AnalysisTy, WithConfig>(); |
| 111 | + } |
| 112 | + |
| 113 | + template <typename AnalysisTy, bool WithConfig = false> |
| 114 | + void executeInterMonoAnalysis() { |
| 115 | + executeAnalysis<InterMonoSolver_P<AnalysisTy, 3>, AnalysisTy, WithConfig>(); |
| 116 | + } |
| 117 | + |
| 118 | + template <typename AnalysisTy, bool WithConfig = false> |
| 119 | + void executeIFDSAnalysis() { |
| 120 | + executeAnalysis<IFDSSolver_P<AnalysisTy>, AnalysisTy, WithConfig>(); |
| 121 | + } |
| 122 | + |
| 123 | + template <typename AnalysisTy, bool WithConfig = false> |
| 124 | + void executeIDEAnalysis() { |
| 125 | + executeAnalysis<IDESolver_P<AnalysisTy>, AnalysisTy, WithConfig>(); |
| 126 | + } |
| 127 | + |
| 128 | + template <class Solver_P, typename AnalysisTy, bool WithConfig> |
| 129 | + void executeAnalysis() { |
| 130 | + if constexpr (WithConfig) { |
| 131 | + std::string AnalysisConfigPath = |
| 132 | + (0 < AnalysisConfigs.size()) ? AnalysisConfigs[0] : ""; |
| 133 | + auto Config = |
| 134 | + !AnalysisConfigPath.empty() |
| 135 | + ? TaintConfig(IRDB, parseTaintConfig(AnalysisConfigPath)) |
| 136 | + : TaintConfig(IRDB); |
| 137 | + WholeProgramAnalysis<Solver_P, AnalysisTy> WPA( |
| 138 | + SolverConfig, IRDB, &Config, EntryPoints, &PT, &ICF, &TH); |
| 139 | + WPA.solve(); |
| 140 | + emitRequestedDataFlowResults(WPA); |
| 141 | + WPA.releaseAllHelperAnalyses(); |
| 142 | + } else { |
| 143 | + WholeProgramAnalysis<Solver_P, AnalysisTy> WPA( |
| 144 | + SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
| 145 | + WPA.solve(); |
| 146 | + emitRequestedDataFlowResults(WPA); |
| 147 | + WPA.releaseAllHelperAnalyses(); |
| 148 | + } |
| 149 | + } |
| 150 | + |
84 | 151 | std::unique_ptr<llvm::raw_fd_ostream> |
85 | 152 | openFileStream(llvm::StringRef Filename); |
86 | 153 |
|
@@ -121,7 +188,7 @@ class AnalysisController { |
121 | 188 |
|
122 | 189 | public: |
123 | 190 | AnalysisController(ProjectIRDB &IRDB, |
124 | | - std::vector<DataFlowAnalysisKind> DataFlowAnalyses, |
| 191 | + std::vector<DataFlowAnalysisType> DataFlowAnalyses, |
125 | 192 | std::vector<std::string> AnalysisConfigs, |
126 | 193 | PointerAnalysisType PTATy, CallGraphAnalysisType CGTy, |
127 | 194 | Soundness SoundnessLevel, bool AutoGlobalSupport, |
|
0 commit comments