|
21 | 21 | #include "phasar/DB/ProjectIRDB.h" |
22 | 22 | #include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.h" |
23 | 23 | #include "phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h" |
24 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysis.h" |
25 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEInstInteractionAnalysis.h" |
26 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDELinearConstantAnalysis.h" |
27 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEProtoAnalysis.h" |
28 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDESolverTest.h" |
29 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDETaintAnalysis.h" |
30 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDETypeStateAnalysis.h" |
31 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSConstAnalysis.h" |
32 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSFieldSensTaintAnalysis.h" |
33 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSLinearConstantAnalysis.h" |
34 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSProtoAnalysis.h" |
35 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSSignAnalysis.h" |
36 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSSolverTest.h" |
37 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSTaintAnalysis.h" |
38 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSTypeAnalysis.h" |
39 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSUninitializedVariables.h" |
40 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/TypeStateDescriptions/CSTDFILEIOTypeStateDescription.h" |
41 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/TypeStateDescriptions/OpenSSLEVPKDFDescription.h" |
42 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h" |
43 | | -#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IFDSSolver.h" |
44 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Problems/InterMonoSolverTest.h" |
45 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Problems/InterMonoTaintAnalysis.h" |
46 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Problems/IntraMonoFullConstantPropagation.h" |
47 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Problems/IntraMonoSolverTest.h" |
48 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/InterMonoSolver.h" |
49 | | -#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/IntraMonoSolver.h" |
50 | | -#include "phasar/PhasarLLVM/Plugins/PluginFactories.h" |
51 | 24 | #include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h" |
52 | 25 | #include "phasar/Utils/Utilities.h" |
53 | 26 |
|
@@ -137,203 +110,73 @@ void AnalysisController::executeVariational() {} |
137 | 110 |
|
138 | 111 | void AnalysisController::executeWholeProgram() { |
139 | 112 | size_t ConfigIdx = 0; |
140 | | - for (const auto &DFA : DataFlowAnalyses) { |
141 | | - std::string AnalysisConfigPath = |
142 | | - (ConfigIdx < AnalysisConfigs.size()) ? AnalysisConfigs[ConfigIdx] : ""; |
143 | | - if (std::holds_alternative<DataFlowAnalysisType>(DFA)) { |
144 | | - auto getTaintConfig // NOLINT |
145 | | - = [&]() { |
146 | | - if (!AnalysisConfigPath.empty()) { |
147 | | - return TaintConfig(IRDB, parseTaintConfig(AnalysisConfigPath)); |
148 | | - } |
149 | | - return TaintConfig(IRDB); |
150 | | - }; |
151 | | - auto DataFlowAnalysis = std::get<DataFlowAnalysisType>(DFA); |
152 | | - switch (DataFlowAnalysis) { |
153 | | - case DataFlowAnalysisType::IFDSUninitializedVariables: { |
154 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSUninitializedVariables>, |
155 | | - IFDSUninitializedVariables> |
156 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
157 | | - WPA.solve(); |
158 | | - emitRequestedDataFlowResults(WPA); |
159 | | - WPA.releaseAllHelperAnalyses(); |
160 | | - } break; |
161 | | - case DataFlowAnalysisType::IFDSConstAnalysis: { |
162 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSConstAnalysis>, IFDSConstAnalysis> |
163 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
164 | | - WPA.solve(); |
165 | | - emitRequestedDataFlowResults(WPA); |
166 | | - WPA.releaseAllHelperAnalyses(); |
167 | | - } break; |
168 | | - case DataFlowAnalysisType::IFDSTaintAnalysis: { |
169 | | - auto Config = getTaintConfig(); |
170 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSTaintAnalysis>, IFDSTaintAnalysis> |
171 | | - WPA(SolverConfig, IRDB, &Config, EntryPoints, &PT, &ICF, &TH); |
172 | | - WPA.solve(); |
173 | | - emitRequestedDataFlowResults(WPA); |
174 | | - WPA.releaseAllHelperAnalyses(); |
175 | | - } break; |
176 | | - case DataFlowAnalysisType::IDEExtendedTaintAnalysis: { |
177 | | - auto Config = getTaintConfig(); |
178 | | - WholeProgramAnalysis<IDESolver_P<IDEExtendedTaintAnalysis<>>, |
179 | | - IDEExtendedTaintAnalysis<>> |
180 | | - WPA(SolverConfig, IRDB, &Config, EntryPoints, &PT, &ICF, &TH); |
181 | | - WPA.solve(); |
182 | | - emitRequestedDataFlowResults(WPA); |
183 | | - WPA.releaseAllHelperAnalyses(); |
184 | | - } break; |
185 | | - case DataFlowAnalysisType::IDETaintAnalysis: { |
186 | | - /// TODO: The IDETaintAnalysis seems not to be implemented at all. |
187 | | - /// So, keep the error-message until we have an implementation |
| 113 | + for (const auto &DataFlowAnalysis : DataFlowAnalyses) { |
| 114 | + switch (DataFlowAnalysis) { |
| 115 | + case DataFlowAnalysisType::IFDSUninitializedVariables: { |
| 116 | + executeIFDSUninitVar(); |
| 117 | + } break; |
| 118 | + case DataFlowAnalysisType::IFDSConstAnalysis: { |
| 119 | + executeIFDSConst(); |
| 120 | + } break; |
| 121 | + case DataFlowAnalysisType::IFDSTaintAnalysis: { |
| 122 | + executeIFDSTaint(); |
| 123 | + } break; |
| 124 | + case DataFlowAnalysisType::IDEExtendedTaintAnalysis: { |
| 125 | + executeIDEXTaint(); |
| 126 | + } break; |
| 127 | + case DataFlowAnalysisType::IDETaintAnalysis: { |
| 128 | + /// TODO: The IDETaintAnalysis seems not to be implemented at all. |
| 129 | + /// So, keep the error-message until we have an implementation |
188 | 130 |
|
189 | | - // WholeProgramAnalysis<IDESolver_P<IDETaintAnalysis>, IDETaintAnalysis> |
190 | | - // WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
191 | | - // WPA.solve(); |
192 | | - // emitRequestedDataFlowResults(WPA); |
193 | | - // WPA.releaseAllHelperAnalyses(); |
194 | | - std::cerr << "The IDETaintAnalysis is currently not available! Please " |
195 | | - "use one of the other taint analyses.\n"; |
196 | | - } break; |
197 | | - case DataFlowAnalysisType::IDEOpenSSLTypeStateAnalysis: { |
198 | | - OpenSSLEVPKDFDescription TSDesc; |
199 | | - WholeProgramAnalysis<IDESolver_P<IDETypeStateAnalysis>, |
200 | | - IDETypeStateAnalysis> |
201 | | - WPA(SolverConfig, IRDB, &TSDesc, EntryPoints, &PT, &ICF, &TH); |
202 | | - WPA.solve(); |
203 | | - emitRequestedDataFlowResults(WPA); |
204 | | - WPA.releaseAllHelperAnalyses(); |
205 | | - } break; |
206 | | - case DataFlowAnalysisType::IDECSTDIOTypeStateAnalysis: { |
207 | | - CSTDFILEIOTypeStateDescription TSDesc; |
208 | | - WholeProgramAnalysis<IDESolver_P<IDETypeStateAnalysis>, |
209 | | - IDETypeStateAnalysis> |
210 | | - WPA(SolverConfig, IRDB, &TSDesc, EntryPoints, &PT, &ICF, &TH); |
211 | | - WPA.solve(); |
212 | | - emitRequestedDataFlowResults(WPA); |
213 | | - WPA.releaseAllHelperAnalyses(); |
214 | | - } break; |
215 | | - case DataFlowAnalysisType::IFDSTypeAnalysis: { |
216 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSTypeAnalysis>, IFDSTypeAnalysis> |
217 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
218 | | - WPA.solve(); |
219 | | - emitRequestedDataFlowResults(WPA); |
220 | | - WPA.releaseAllHelperAnalyses(); |
221 | | - } break; |
222 | | - case DataFlowAnalysisType::IFDSSolverTest: { |
223 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSSolverTest>, IFDSSolverTest> WPA( |
224 | | - SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
225 | | - WPA.solve(); |
226 | | - emitRequestedDataFlowResults(WPA); |
227 | | - WPA.releaseAllHelperAnalyses(); |
228 | | - } break; |
229 | | - case DataFlowAnalysisType::IFDSLinearConstantAnalysis: { |
230 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSLinearConstantAnalysis>, |
231 | | - IFDSLinearConstantAnalysis> |
232 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
233 | | - WPA.solve(); |
234 | | - emitRequestedDataFlowResults(WPA); |
235 | | - WPA.releaseAllHelperAnalyses(); |
236 | | - } break; |
237 | | - case DataFlowAnalysisType::IFDSFieldSensTaintAnalysis: { |
238 | | - auto Config = getTaintConfig(); |
239 | | - WholeProgramAnalysis<IFDSSolver_P<IFDSFieldSensTaintAnalysis>, |
240 | | - IFDSFieldSensTaintAnalysis> |
241 | | - WPA(SolverConfig, IRDB, &Config, EntryPoints, &PT, &ICF, &TH); |
242 | | - WPA.solve(); |
243 | | - emitRequestedDataFlowResults(WPA); |
244 | | - WPA.releaseAllHelperAnalyses(); |
245 | | - } break; |
246 | | - case DataFlowAnalysisType::IDELinearConstantAnalysis: { |
247 | | - WholeProgramAnalysis<IDESolver_P<IDELinearConstantAnalysis>, |
248 | | - IDELinearConstantAnalysis> |
249 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
250 | | - WPA.solve(); |
251 | | - emitRequestedDataFlowResults(WPA); |
252 | | - WPA.releaseAllHelperAnalyses(); |
253 | | - } break; |
254 | | - case DataFlowAnalysisType::IDESolverTest: { |
255 | | - WholeProgramAnalysis<IDESolver_P<IDESolverTest>, IDESolverTest> WPA( |
256 | | - SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
257 | | - WPA.solve(); |
258 | | - emitRequestedDataFlowResults(WPA); |
259 | | - WPA.releaseAllHelperAnalyses(); |
260 | | - } break; |
261 | | - case DataFlowAnalysisType::IDEInstInteractionAnalysis: { |
262 | | - WholeProgramAnalysis<IDESolver_P<IDEInstInteractionAnalysis>, |
263 | | - IDEInstInteractionAnalysis> |
264 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
265 | | - WPA.solve(); |
266 | | - emitRequestedDataFlowResults(WPA); |
267 | | - WPA.releaseAllHelperAnalyses(); |
268 | | - } break; |
269 | | - case DataFlowAnalysisType::IntraMonoFullConstantPropagation: { |
270 | | - WholeProgramAnalysis< |
271 | | - IntraMonoSolver_P<IntraMonoFullConstantPropagation>, |
272 | | - IntraMonoFullConstantPropagation> |
273 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
274 | | - WPA.solve(); |
275 | | - emitRequestedDataFlowResults(WPA); |
276 | | - WPA.releaseAllHelperAnalyses(); |
277 | | - } break; |
278 | | - case DataFlowAnalysisType::IntraMonoSolverTest: { |
279 | | - WholeProgramAnalysis<IntraMonoSolver_P<IntraMonoSolverTest>, |
280 | | - IntraMonoSolverTest> |
281 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
282 | | - WPA.solve(); |
283 | | - emitRequestedDataFlowResults(WPA); |
284 | | - WPA.releaseAllHelperAnalyses(); |
285 | | - } break; |
286 | | - case DataFlowAnalysisType::InterMonoSolverTest: { |
287 | | - WholeProgramAnalysis<InterMonoSolver_P<InterMonoSolverTest, 3>, |
288 | | - InterMonoSolverTest> |
289 | | - WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
290 | | - WPA.solve(); |
291 | | - emitRequestedDataFlowResults(WPA); |
292 | | - WPA.releaseAllHelperAnalyses(); |
293 | | - } break; |
294 | | - case DataFlowAnalysisType::InterMonoTaintAnalysis: { |
295 | | - auto Config = getTaintConfig(); |
296 | | - WholeProgramAnalysis<InterMonoSolver_P<InterMonoTaintAnalysis, 3>, |
297 | | - InterMonoTaintAnalysis> |
298 | | - WPA(SolverConfig, IRDB, &Config, EntryPoints, &PT, &ICF, &TH); |
299 | | - WPA.solve(); |
300 | | - emitRequestedDataFlowResults(WPA); |
301 | | - WPA.releaseAllHelperAnalyses(); |
302 | | - } break; |
303 | | - default: |
304 | | - break; |
305 | | - } |
306 | | - } else if (std::holds_alternative<IFDSPluginConstructor>(DFA)) { |
307 | | - auto Problem = std::get<IFDSPluginConstructor>(DFA)(&IRDB, &TH, &ICF, &PT, |
308 | | - EntryPoints); |
309 | | - Problem->setIFDSIDESolverConfig(SolverConfig); |
310 | | - IFDSSolver_P<std::remove_reference<decltype(*Problem)>::type> Solver( |
311 | | - *Problem); |
312 | | - Solver.solve(); |
313 | | - emitRequestedDataFlowResults(Solver); |
314 | | - } else if (std::holds_alternative<IDEPluginConstructor>(DFA)) { |
315 | | - auto Problem = std::get<IDEPluginConstructor>(DFA)(&IRDB, &TH, &ICF, &PT, |
316 | | - EntryPoints); |
317 | | - Problem->setIFDSIDESolverConfig(SolverConfig); |
318 | | - IDESolver_P<std::remove_reference<decltype(*Problem)>::type> Solver( |
319 | | - *Problem); |
320 | | - Solver.solve(); |
321 | | - emitRequestedDataFlowResults(Solver); |
322 | | - } else if (std::holds_alternative<IntraMonoPluginConstructor>(DFA)) { |
323 | | - |
324 | | - auto Problem = std::get<IntraMonoPluginConstructor>(DFA)( |
325 | | - &IRDB, &TH, &ICF, &PT, EntryPoints); |
326 | | - IntraMonoSolver_P<std::remove_reference<decltype(*Problem)>::type> Solver( |
327 | | - *Problem); |
328 | | - Solver.solve(); |
329 | | - emitRequestedDataFlowResults(Solver); |
330 | | - } else if (std::holds_alternative<InterMonoPluginConstructor>(DFA)) { |
331 | | - auto Problem = std::get<InterMonoPluginConstructor>(DFA)( |
332 | | - &IRDB, &TH, &ICF, &PT, EntryPoints); |
333 | | - InterMonoSolver_P<std::remove_reference<decltype(*Problem)>::type, K> |
334 | | - Solver(*Problem); |
335 | | - Solver.solve(); |
336 | | - emitRequestedDataFlowResults(Solver); |
| 131 | + // WholeProgramAnalysis<IDESolver_P<IDETaintAnalysis>, IDETaintAnalysis> |
| 132 | + // WPA(SolverConfig, IRDB, EntryPoints, &PT, &ICF, &TH); |
| 133 | + // WPA.solve(); |
| 134 | + // emitRequestedDataFlowResults(WPA); |
| 135 | + // WPA.releaseAllHelperAnalyses(); |
| 136 | + std::cerr << "The IDETaintAnalysis is currently not available! Please " |
| 137 | + "use one of the other taint analyses.\n"; |
| 138 | + } break; |
| 139 | + case DataFlowAnalysisType::IDEOpenSSLTypeStateAnalysis: { |
| 140 | + executeIDEOpenSSLTS(); |
| 141 | + } break; |
| 142 | + case DataFlowAnalysisType::IDECSTDIOTypeStateAnalysis: { |
| 143 | + executeIDECSTDIOTS(); |
| 144 | + } break; |
| 145 | + case DataFlowAnalysisType::IFDSTypeAnalysis: { |
| 146 | + executeIFDSType(); |
| 147 | + } break; |
| 148 | + case DataFlowAnalysisType::IFDSSolverTest: { |
| 149 | + executeIFDSSolverTest(); |
| 150 | + } break; |
| 151 | + case DataFlowAnalysisType::IFDSLinearConstantAnalysis: { |
| 152 | + executeIFDSLinearConst(); |
| 153 | + } break; |
| 154 | + case DataFlowAnalysisType::IFDSFieldSensTaintAnalysis: { |
| 155 | + executeIFDSFieldSensTaint(); |
| 156 | + } break; |
| 157 | + case DataFlowAnalysisType::IDELinearConstantAnalysis: { |
| 158 | + executeIDELinearConst(); |
| 159 | + } break; |
| 160 | + case DataFlowAnalysisType::IDESolverTest: { |
| 161 | + executeIDESolverTest(); |
| 162 | + } break; |
| 163 | + case DataFlowAnalysisType::IDEInstInteractionAnalysis: { |
| 164 | + executeIDEIIA(); |
| 165 | + } break; |
| 166 | + case DataFlowAnalysisType::IntraMonoFullConstantPropagation: { |
| 167 | + executeIntraMonoFullConstant(); |
| 168 | + } break; |
| 169 | + case DataFlowAnalysisType::IntraMonoSolverTest: { |
| 170 | + executeIntraMonoSolverTest(); |
| 171 | + } break; |
| 172 | + case DataFlowAnalysisType::InterMonoSolverTest: { |
| 173 | + executeInterMonoSolverTest(); |
| 174 | + } break; |
| 175 | + case DataFlowAnalysisType::InterMonoTaintAnalysis: { |
| 176 | + executeInterMonoTaint(); |
| 177 | + } break; |
| 178 | + default: |
| 179 | + break; |
337 | 180 | } |
338 | 181 | } |
339 | 182 | } |
|
0 commit comments