Skip to content

Rework Folder Structure #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

/img @pdschubert

/include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEInstInteractionAnalysis.h @pdschubert @vulder
/include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/ @fabianbs96
/include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysis.h @fabianbs96
/lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysis.cpp @fabianbs96
/lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/ @fabianbs96
/include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEInstInteractionAnalysis.h @pdschubert @vulder
/include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/ExtendedTaintAnalysis/ @fabianbs96
/include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEExtendedTaintAnalysis.h @fabianbs96
/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEExtendedTaintAnalysis.cpp @fabianbs96
/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/ExtendedTaintAnalysis/ @fabianbs96

/include/phasar/PhasarLLVM/AnalysisStrategy/ @pdschubert

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ endif()

set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Install dir of headers")

# Install targets of phasar-llvm, other executables, and libraries are to be
# Install targets of phasar-cli, other executables, and libraries are to be
# found in the individual subdirectories of tools/

# Install Phasar include directory
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ RUN mkdir -p build && cd build && \
-G Ninja && \
cmake --build .

ENTRYPOINT [ "./build/tools/phasar-llvm/phasar-llvm" ]
ENTRYPOINT [ "./build/tools/phasar-cli/phasar-cli" ]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ Use them as a reference if you wish to modify PhASAR and recompile it.

After compilation using cmake the following two binaries can be found in the build/ directory:

+ phasar-llvm - the actual PhASAR command-line tool
+ phasar-cli - the actual PhASAR command-line tool (previously called `phasar-llvm`)
+ myphasartool - an example tool that shows how tools can be build on top of PhASAR

Use the command:

`$ ./phasar-llvm --help`
`$ ./phasar-cli --help`

in order to display the manual and help message.

Expand Down Expand Up @@ -167,7 +167,7 @@ C++'s long compile times are always a pain. As shown in the above, when using cm
### Running a test solver
To test if everything works as expected please run the following command:

`$ phasar-llvm --module test/build_systems_tests/installation_tests/module.ll -D ifds-solvertest`
`$ phasar-cli -m test/build_systems_tests/installation_tests/module.ll -D ifds-solvertest`

If you obtain output other than a segmentation fault or an exception terminating the program abnormally everything works as expected.

Expand Down
10 changes: 7 additions & 3 deletions cmake/phasar_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ function(add_phasar_unittest test_name)
LINK_PUBLIC
phasar_config
phasar_controller
phasar_llvm_controlflow
phasar_controlflow
phasar_phasarllvm_utils
phasar_llvm_utils
phasar_analysis_strategy
phasar_ifdside
phasar_llvm_ifdside
phasar_utils
phasar_mono
phasar_llvm_db
phasar_db
# phasar_clang
phasar_passes
phasar_llvm_pointer
phasar_pointer
phasar_typehierarchy
phasar_llvm_typehierarchy
phasar_llvm
phasar_taintconfig
nlohmann_json_schema_validator
${SQLITE3_LIBRARY}
Expand Down
6 changes: 3 additions & 3 deletions examples/llvm-hello-world/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include <memory>
#include <string>

#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
Expand All @@ -15,6 +12,9 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"

#include <memory>
#include <string>

int main(int argc, char **argv) {
if (argc != 2) {
llvm::errs() << "usage: <prog> <IR file>\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace psr {
enum class AnalysisStrategy {
None,
#define ANALYSIS_STRATEGY_TYPES(NAME, CMDFLAG, DESC) NAME,
#include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.def"
#include "phasar/AnalysisStrategy/Strategies.def"

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#ifndef PHASAR_PHASARLLVM_ANALYSISSTRATEGY_VARIATIONALANALYSIS_H_
#define PHASAR_PHASARLLVM_ANALYSISSTRATEGY_VARIATIONALANALYSIS_H_

#include "phasar/PhasarLLVM/AnalysisStrategy/AnalysisSetup.h"
#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/IntraMonoSolver.h"
#include "phasar/AnalysisStrategy/AnalysisSetup.h"

#include <type_traits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_CFGBASE_H
#define PHASAR_PHASARLLVM_CONTROLFLOW_CFGBASE_H

#include "phasar/PhasarLLVM/Utils/ByRef.h"
#include "phasar/Utils/ByRef.h"
#include "phasar/Utils/TypeTraits.h"

#include "nlohmann/json.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace psr {
enum class CallGraphAnalysisType {
#define CALL_GRAPH_ANALYSIS_TYPE(NAME, CMDFLAG, DESC) NAME,
#include "phasar/PhasarLLVM/ControlFlow/Resolver/CallGraphAnalysisType.def"
#include "phasar/ControlFlow/CallGraphAnalysisType.def"
Invalid
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_ICFGBASE_H
#define PHASAR_PHASARLLVM_CONTROLFLOW_ICFGBASE_H

#include "phasar/PhasarLLVM/ControlFlow/CFGBase.h"
#include "phasar/ControlFlow/CFGBase.h"
#include "phasar/Utils/TypeTraits.h"

#include "llvm/ADT/StringRef.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace psr {

enum class SpecialMemberFunctionType {
#define SPECIAL_MEMBER_FUNCTION_TYPES(NAME, TYPE) TYPE,
#include "phasar/PhasarLLVM/ControlFlow/SpecialMemberFunctionType.def"
#include "phasar/ControlFlow/SpecialMemberFunctionType.def"
};

std::string toString(SpecialMemberFunctionType SMFT);
Expand Down
19 changes: 9 additions & 10 deletions include/phasar/Controller/AnalysisController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
#ifndef PHASAR_CONTROLLER_ANALYSISCONTROLLER_H
#define PHASAR_CONTROLLER_ANALYSISCONTROLLER_H

#include "phasar/AnalysisStrategy/Strategies.h"
#include "phasar/Controller/AnalysisControllerEmitterOptions.h"
#include "phasar/DB/LLVMProjectIRDB.h"
#include "phasar/PhasarLLVM/AnalysisStrategy/HelperAnalyses.h"
#include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.h"
#include "phasar/DataFlow/IfdsIde/IFDSIDESolverConfig.h"
#include "phasar/DataFlow/IfdsIde/Solver/IDESolver.h"
#include "phasar/DataFlow/IfdsIde/Solver/IFDSSolver.h"
#include "phasar/DataFlow/IfdsIde/SolverResults.h"
#include "phasar/DataFlow/Mono/Solver/InterMonoSolver.h"
#include "phasar/DataFlow/Mono/Solver/IntraMonoSolver.h"
#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IFDSSolver.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/SolverResults.h"
#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/InterMonoSolver.h"
#include "phasar/PhasarLLVM/DataFlowSolver/Mono/Solver/IntraMonoSolver.h"
#include "phasar/PhasarLLVM/DB/LLVMProjectIRDB.h"
#include "phasar/PhasarLLVM/HelperAnalyses.h"
#include "phasar/PhasarLLVM/Pointer/LLVMAliasSet.h"
#include "phasar/PhasarLLVM/Pointer/LLVMBasedAliasAnalysis.h"
#include "phasar/PhasarLLVM/TaintConfig/TaintConfig.h"
#include "phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h"
#include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONCOMPOSER_H
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONCOMPOSER_H

#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctionUtils.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctions.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctionUtils.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctions.h"

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* Philipp Schubert, Fabian Schiebel and others
*****************************************************************************/

#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONUTILS_H_
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONUTILS_H_
#ifndef PHASAR_DATAFLOW_IFDSIDE_EDGEFUNCTIONUTILS_H_
#define PHASAR_DATAFLOW_IFDSIDE_EDGEFUNCTIONUTILS_H_

#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctions.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/JoinLattice.h"
#include "phasar/PhasarLLVM/Utils/ByRef.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctions.h"
#include "phasar/Utils/ByRef.h"
#include "phasar/Utils/JoinLattice.h"

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONS_H_
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_EDGEFUNCTIONS_H_

#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/JoinLattice.h"
#include "phasar/PhasarLLVM/Utils/ByRef.h"
#include "phasar/Utils/ByRef.h"
#include "phasar/Utils/JoinLattice.h"
#include "phasar/Utils/TypeTraits.h"

#include "llvm/ADT/ArrayRef.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_IDETABULATIONPROBLEM_H_
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_IDETABULATIONPROBLEM_H_

#include "phasar/ControlFlow/ICFGBase.h"
#include "phasar/DB/ProjectIRDBBase.h"
#include "phasar/PhasarLLVM/ControlFlow/ICFGBase.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctions.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/FlowFunctions.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/InitialSeeds.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/JoinLattice.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/SolverResults.h"
#include "phasar/PhasarLLVM/Utils/Printer.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctions.h"
#include "phasar/DataFlow/IfdsIde/FlowFunctions.h"
#include "phasar/DataFlow/IfdsIde/IFDSIDESolverConfig.h"
#include "phasar/DataFlow/IfdsIde/InitialSeeds.h"
#include "phasar/DataFlow/IfdsIde/SolverResults.h"
#include "phasar/Utils/JoinLattice.h"
#include "phasar/Utils/Printer.h"
#include "phasar/Utils/Soundness.h"

#include <cassert>
Expand Down Expand Up @@ -55,13 +55,11 @@ class IDETabulationProblem : public FlowFunctions<AnalysisDomainTy, Container>,

using ConfigurationTy = HasNoConfigurationType;

explicit IDETabulationProblem(const db_t *IRDB,
explicit IDETabulationProblem(const ProjectIRDBBase<db_t> *IRDB,
std::vector<std::string> EntryPoints,
std::optional<d_t> ZeroValue)
: IRDB(IRDB), EntryPoints(std::move(EntryPoints)),
ZeroValue(std::move(ZeroValue)) {
static_assert(std::is_base_of_v<ProjectIRDBBase<db_t>, db_t>,
"db_t must implement the ProjectIRDBBase interface!");
assert(IRDB != nullptr);
}

Expand Down Expand Up @@ -128,7 +126,7 @@ class IDETabulationProblem : public FlowFunctions<AnalysisDomainTy, Container>,
return generateFlow(std::move(FactToGenerate), getZeroValue());
}

const db_t *IRDB{};
const ProjectIRDBBase<db_t> *IRDB{};
std::vector<std::string> EntryPoints;
std::optional<d_t> ZeroValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ enum class SolverConfigOptions : uint32_t {
struct IFDSIDESolverConfig {
IFDSIDESolverConfig() noexcept = default;
IFDSIDESolverConfig(SolverConfigOptions Options) noexcept;
~IFDSIDESolverConfig() = default;
IFDSIDESolverConfig(const IFDSIDESolverConfig &) noexcept = default;
IFDSIDESolverConfig &
operator=(const IFDSIDESolverConfig &) noexcept = default;
IFDSIDESolverConfig(IFDSIDESolverConfig &&) noexcept = default;
IFDSIDESolverConfig &operator=(IFDSIDESolverConfig &&) noexcept = default;

[[nodiscard]] bool followReturnsPastSeeds() const;
[[nodiscard]] bool autoAddZero() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_IFDSTABULATIONPROBLEM_H
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_IFDSTABULATIONPROBLEM_H

#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctionUtils.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IDETabulationProblem.h"
#include "phasar/PhasarLLVM/Domain/AnalysisDomain.h"
#include "phasar/PhasarLLVM/Utils/BinaryDomain.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctionUtils.h"
#include "phasar/DataFlow/IfdsIde/IDETabulationProblem.h"
#include "phasar/Domain/AnalysisDomain.h"
#include "phasar/Domain/BinaryDomain.h"

#include <set>
#include <string>
Expand All @@ -40,7 +40,7 @@ class IFDSTabulationProblem
using typename Base::t_t;
using typename Base::v_t;

explicit IFDSTabulationProblem(const db_t *IRDB,
explicit IFDSTabulationProblem(const ProjectIRDBBase<db_t> *IRDB,
std::vector<std::string> EntryPoints,
d_t ZeroValue)
: Base(IRDB, std::move(EntryPoints), std::move(ZeroValue)) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_INITIALSEEDS_H
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_INITIALSEEDS_H

#include "phasar/PhasarLLVM/Utils/BinaryDomain.h"
#include "phasar/Domain/BinaryDomain.h"
#include "phasar/PhasarLLVM/Utils/LLVMShorthands.h"

#include <map>
Expand Down Expand Up @@ -72,39 +72,6 @@ template <typename N, typename D, typename L> class InitialSeeds {
[[nodiscard]] const GeneralizedSeeds &getSeeds() const & { return Seeds; }
[[nodiscard]] GeneralizedSeeds getSeeds() && { return std::move(Seeds); }

void dump(llvm::raw_ostream &OS = llvm::errs()) {

auto printNode = [&](auto &&Node) { // NOLINT
if constexpr (std::is_same_v<const llvm::Instruction *, N>) {
OS << llvmIRToString(Node);
} else {
OS << Node;
}
};

auto printFact = [&](auto &&Node) { // NOLINT
if constexpr (std::is_same_v<const llvm::Value *, D>) {
OS << llvmIRToString(Node);
} else {
OS << Node;
}
};

OS << "======================== Initial Seeds ========================\n";
for (const auto &[Node, Facts] : Seeds) {
OS << "At ";
printNode(Node);
OS << "\n";
for (const auto &[Fact, Value] : Facts) {
OS << "> ";
printFact(Fact);
OS << " --> \\." << Value << "\n";
}
OS << "\n";
}
OS << "========================== End Seeds ==========================\n";
}

private:
GeneralizedSeeds Seeds;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_FLOWEDGEFUNCTIONCACHE_H_
#define PHASAR_PHASARLLVM_DATAFLOWSOLVER_IFDSIDE_FLOWEDGEFUNCTIONCACHE_H_

#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/EdgeFunctions.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IDETabulationProblem.h"
#include "phasar/DataFlow/IfdsIde/EdgeFunctions.h"
#include "phasar/DataFlow/IfdsIde/IDETabulationProblem.h"
#include "phasar/Utils/EquivalenceClassMap.h"
#include "phasar/Utils/Logger.h"
#include "phasar/Utils/PAMMMacros.h"
Expand All @@ -26,6 +26,10 @@
#include <type_traits>
#include <utility>

namespace llvm {
class Value;
} // namespace llvm

namespace psr {
template <typename KeyT> class DefaultMapKeyCompressor {
public:
Expand Down
Loading