From 6ccc6ff7b42c5508942b177a8d155e928136c89f Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 May 2023 20:35:25 +0200 Subject: [PATCH 1/8] Add consolidated header files --- include/phasar.h | 27 +++++++++++++++++ include/phasar/AnalysisStrategy.h | 20 ++++++++++++ include/phasar/Config.h | 16 ++++++++++ include/phasar/ControlFlow.h | 18 +++++++++++ include/phasar/Controller.h | 16 ++++++++++ include/phasar/DB.h | 17 +++++++++++ include/phasar/DataFlow.h | 36 ++++++++++++++++++++++ include/phasar/Domain.h | 17 +++++++++++ include/phasar/PhasarClang.h | 18 +++++++++++ include/phasar/PhasarLLVM.h | 26 ++++++++++++++++ include/phasar/PhasarLLVM/ControlFlow.h | 23 ++++++++++++++ include/phasar/PhasarLLVM/DB.h | 15 +++++++++ include/phasar/PhasarLLVM/DataFlow.h | 33 ++++++++++++++++++++ include/phasar/PhasarLLVM/Domain.h | 15 +++++++++ include/phasar/PhasarLLVM/Passes.h | 17 +++++++++++ include/phasar/PhasarLLVM/Pointer.h | 22 ++++++++++++++ include/phasar/PhasarLLVM/TaintConfig.h | 17 +++++++++++ include/phasar/PhasarLLVM/TypeHierarchy.h | 16 ++++++++++ include/phasar/PhasarLLVM/Utils.h | 21 +++++++++++++ include/phasar/PhasarPass.h | 18 +++++++++++ include/phasar/Pointer.h | 22 ++++++++++++++ include/phasar/TypeHierarchy.h | 16 ++++++++++ include/phasar/Utils.h | 37 +++++++++++++++++++++++ lib/CMakeLists.txt | 5 +++ lib/LibPhasar.cpp | 10 ++++++ 25 files changed, 498 insertions(+) create mode 100644 include/phasar.h create mode 100644 include/phasar/AnalysisStrategy.h create mode 100644 include/phasar/Config.h create mode 100644 include/phasar/ControlFlow.h create mode 100644 include/phasar/Controller.h create mode 100644 include/phasar/DB.h create mode 100644 include/phasar/DataFlow.h create mode 100644 include/phasar/Domain.h create mode 100644 include/phasar/PhasarClang.h create mode 100644 include/phasar/PhasarLLVM.h create mode 100644 include/phasar/PhasarLLVM/ControlFlow.h create mode 100644 include/phasar/PhasarLLVM/DB.h create mode 100644 include/phasar/PhasarLLVM/DataFlow.h create mode 100644 include/phasar/PhasarLLVM/Domain.h create mode 100644 include/phasar/PhasarLLVM/Passes.h create mode 100644 include/phasar/PhasarLLVM/Pointer.h create mode 100644 include/phasar/PhasarLLVM/TaintConfig.h create mode 100644 include/phasar/PhasarLLVM/TypeHierarchy.h create mode 100644 include/phasar/PhasarLLVM/Utils.h create mode 100644 include/phasar/PhasarPass.h create mode 100644 include/phasar/Pointer.h create mode 100644 include/phasar/TypeHierarchy.h create mode 100644 include/phasar/Utils.h create mode 100644 lib/LibPhasar.cpp diff --git a/include/phasar.h b/include/phasar.h new file mode 100644 index 0000000000..2702a71211 --- /dev/null +++ b/include/phasar.h @@ -0,0 +1,27 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_H +#define PHASAR_H + +#include "phasar/AnalysisStrategy.h" +#include "phasar/Config.h" +#include "phasar/ControlFlow.h" +#include "phasar/Controller.h" +#include "phasar/DB.h" +#include "phasar/DataFlow.h" +#include "phasar/Domain.h" +#include "phasar/PhasarClang.h" +#include "phasar/PhasarLLVM.h" +#include "phasar/PhasarPass.h" +#include "phasar/Pointer.h" +#include "phasar/TypeHierarchy.h" +#include "phasar/Utils.h" + +#endif // PHASAR_H diff --git a/include/phasar/AnalysisStrategy.h b/include/phasar/AnalysisStrategy.h new file mode 100644 index 0000000000..28bfc30539 --- /dev/null +++ b/include/phasar/AnalysisStrategy.h @@ -0,0 +1,20 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_ANALYSISSTRATEGY_H +#define PHASAR_ANALYSISSTRATEGY_H + +#include "phasar/AnalysisStrategy/AnalysisSetup.h" +#include "phasar/AnalysisStrategy/DemandDrivenAnalysis.h" +#include "phasar/AnalysisStrategy/IncrementalUpdateAnalysis.h" +#include "phasar/AnalysisStrategy/ModuleWiseAnalysis.h" +#include "phasar/AnalysisStrategy/Strategies.h" +#include "phasar/AnalysisStrategy/VariationalAnalysis.h" + +#endif // PHASAR_ANALYSISSTRATEGY_H diff --git a/include/phasar/Config.h b/include/phasar/Config.h new file mode 100644 index 0000000000..57c8ddbeb7 --- /dev/null +++ b/include/phasar/Config.h @@ -0,0 +1,16 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_CONFIG_H +#define PHASAR_CONFIG_H + +#include "phasar/Config/Configuration.h" +#include "phasar/Config/Version.h" + +#endif // PHASAR_CONFIG_H diff --git a/include/phasar/ControlFlow.h b/include/phasar/ControlFlow.h new file mode 100644 index 0000000000..42fec0bc30 --- /dev/null +++ b/include/phasar/ControlFlow.h @@ -0,0 +1,18 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_CONTROLFLOW_H +#define PHASAR_CONTROLFLOW_H + +#include "phasar/ControlFlow/CFGBase.h" +#include "phasar/ControlFlow/CallGraphAnalysisType.h" +#include "phasar/ControlFlow/ICFGBase.h" +#include "phasar/ControlFlow/SpecialMemberFunctionType.h" + +#endif // PHASAR_CONTROLFLOW_H diff --git a/include/phasar/Controller.h b/include/phasar/Controller.h new file mode 100644 index 0000000000..c8ab6dc412 --- /dev/null +++ b/include/phasar/Controller.h @@ -0,0 +1,16 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_CONTROLLER_H +#define PHASAR_CONTROLLER_H + +#include "phasar/Controller/AnalysisController.h" +#include "phasar/Controller/AnalysisControllerEmitterOptions.h" + +#endif // PHASAR_CONTROLLER_H diff --git a/include/phasar/DB.h b/include/phasar/DB.h new file mode 100644 index 0000000000..b50b177149 --- /dev/null +++ b/include/phasar/DB.h @@ -0,0 +1,17 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_DB_H +#define PHASAR_DB_H + +#include "phasar/DB/Hexastore.h" +#include "phasar/DB/ProjectIRDBBase.h" +#include "phasar/DB/Queries.h" + +#endif // PHASAR_DB_H diff --git a/include/phasar/DataFlow.h b/include/phasar/DataFlow.h new file mode 100644 index 0000000000..1e0de999f9 --- /dev/null +++ b/include/phasar/DataFlow.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_DATAFLOW_H +#define PHASAR_DATAFLOW_H + +#include "phasar/DataFlow/IfdsIde/DefaultEdgeFunctionSingletonCache.h" +#include "phasar/DataFlow/IfdsIde/EdgeFunction.h" +#include "phasar/DataFlow/IfdsIde/EdgeFunctionSingletonCache.h" +#include "phasar/DataFlow/IfdsIde/EdgeFunctionUtils.h" +#include "phasar/DataFlow/IfdsIde/EdgeFunctions.h" +#include "phasar/DataFlow/IfdsIde/EntryPointUtils.h" +#include "phasar/DataFlow/IfdsIde/FlowFunctions.h" +#include "phasar/DataFlow/IfdsIde/IDETabulationProblem.h" +#include "phasar/DataFlow/IfdsIde/IFDSTabulationProblem.h" +#include "phasar/DataFlow/IfdsIde/InitialSeeds.h" +#include "phasar/DataFlow/IfdsIde/Solver/FlowEdgeFunctionCache.h" +#include "phasar/DataFlow/IfdsIde/Solver/IDESolver.h" +#include "phasar/DataFlow/IfdsIde/Solver/IFDSSolver.h" +#include "phasar/DataFlow/IfdsIde/Solver/JumpFunctions.h" +#include "phasar/DataFlow/IfdsIde/Solver/PathEdge.h" +#include "phasar/DataFlow/IfdsIde/SolverResults.h" +#include "phasar/DataFlow/IfdsIde/SpecialSummaries.h" +#include "phasar/DataFlow/Mono/Contexts/CallStringCTX.h" +#include "phasar/DataFlow/Mono/InterMonoProblem.h" +#include "phasar/DataFlow/Mono/IntraMonoProblem.h" +#include "phasar/DataFlow/Mono/Solver/InterMonoSolver.h" +#include "phasar/DataFlow/Mono/Solver/IntraMonoSolver.h" + +#endif // PHASAR_DATAFLOW_H diff --git a/include/phasar/Domain.h b/include/phasar/Domain.h new file mode 100644 index 0000000000..596f9b1594 --- /dev/null +++ b/include/phasar/Domain.h @@ -0,0 +1,17 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_DOMAIN_H +#define PHASAR_DOMAIN_H + +#include "phasar/Domain/AnalysisDomain.h" +#include "phasar/Domain/BinaryDomain.h" +#include "phasar/Domain/LatticeDomain.h" + +#endif // PHASAR_DOMAIN_H diff --git a/include/phasar/PhasarClang.h b/include/phasar/PhasarClang.h new file mode 100644 index 0000000000..8e524e4485 --- /dev/null +++ b/include/phasar/PhasarClang.h @@ -0,0 +1,18 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARCLANG_H +#define PHASAR_PHASARCLANG_H + +#include "PhasarClang/ClangController.h" +#include "PhasarClang/RandomChangeASTConsumer.h" +#include "PhasarClang/RandomChangeFrontendAction.h" +#include "PhasarClang/RandomChangeVisitor.h" + +#endif // PHASAR_PHASARCLANG_H diff --git a/include/phasar/PhasarLLVM.h b/include/phasar/PhasarLLVM.h new file mode 100644 index 0000000000..517b5a6108 --- /dev/null +++ b/include/phasar/PhasarLLVM.h @@ -0,0 +1,26 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_H +#define PHASAR_PHASARLLVM_H + +#include "PhasarLLVM/ControlFlow.h" +#include "PhasarLLVM/DB.h" +#include "PhasarLLVM/DataFlow.h" +#include "PhasarLLVM/Domain.h" +#include "PhasarLLVM/HelperAnalyses.h" +#include "PhasarLLVM/HelperAnalysisConfig.h" +#include "PhasarLLVM/Passes.h" +#include "PhasarLLVM/Pointer.h" +#include "PhasarLLVM/SimpleAnalysisConstructor.h" +#include "PhasarLLVM/TaintConfig.h" +#include "PhasarLLVM/TypeHierarchy.h" +#include "PhasarLLVM/Utils.h" + +#endif // PHASAR_PHASARLLVM_H diff --git a/include/phasar/PhasarLLVM/ControlFlow.h b/include/phasar/PhasarLLVM/ControlFlow.h new file mode 100644 index 0000000000..0f4b301359 --- /dev/null +++ b/include/phasar/PhasarLLVM/ControlFlow.h @@ -0,0 +1,23 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_H +#define PHASAR_PHASARLLVM_CONTROLFLOW_H + +#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardCFG.h" +#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h" +#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedCFG.h" +#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h" +#include "phasar/PhasarLLVM/ControlFlow/Resolver/CHAResolver.h" +#include "phasar/PhasarLLVM/ControlFlow/Resolver/NOResolver.h" +#include "phasar/PhasarLLVM/ControlFlow/Resolver/OTFResolver.h" +#include "phasar/PhasarLLVM/ControlFlow/Resolver/RTAResolver.h" +#include "phasar/PhasarLLVM/ControlFlow/Resolver/Resolver.h" + +#endif // PHASAR_PHASARLLVM_CONTROLFLOW_H diff --git a/include/phasar/PhasarLLVM/DB.h b/include/phasar/PhasarLLVM/DB.h new file mode 100644 index 0000000000..e164ece2f1 --- /dev/null +++ b/include/phasar/PhasarLLVM/DB.h @@ -0,0 +1,15 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_DB_H +#define PHASAR_PHASARLLVM_DB_H + +#include "phasar/PhasarLLVM/DB/LLVMProjectIRDB.h" + +#endif // PHASAR_PHASARLLVM_DB_H diff --git a/include/phasar/PhasarLLVM/DataFlow.h b/include/phasar/PhasarLLVM/DataFlow.h new file mode 100644 index 0000000000..abae6a2084 --- /dev/null +++ b/include/phasar/PhasarLLVM/DataFlow.h @@ -0,0 +1,33 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_DATAFLOW_H +#define PHASAR_PHASARLLVM_DATAFLOW_H + +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/LLVMFlowFunctions.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/LLVMSolverResults.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/LLVMZeroValue.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEExtendedTaintAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEGeneralizedLCA/IDEGeneralizedLCA.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDEInstInteractionAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDELinearConstantAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESolverTest.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IFDSSolverTest.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IFDSTaintAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IFDSTypeAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IFDSUninitializedVariables.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/InterMonoFullConstantPropagation.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/InterMonoSolverTest.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/InterMonoTaintAnalysis.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/IntraMonoFullConstantPropagation.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/IntraMonoSolverTest.h" +#include "phasar/PhasarLLVM/DataFlow/Mono/Problems/IntraMonoUninitVariables.h" + +#endif // PHASAR_PHASARLLVM_DATAFLOW_H diff --git a/include/phasar/PhasarLLVM/Domain.h b/include/phasar/PhasarLLVM/Domain.h new file mode 100644 index 0000000000..db363c242b --- /dev/null +++ b/include/phasar/PhasarLLVM/Domain.h @@ -0,0 +1,15 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_DOMAIN_H +#define PHASAR_PHASARLLVM_DOMAIN_H + +#include "phasar/PhasarLLVM/Domain/LLVMAnalysisDomain.h" + +#endif // PHASAR_PHASARLLVM_DOMAIN_H diff --git a/include/phasar/PhasarLLVM/Passes.h b/include/phasar/PhasarLLVM/Passes.h new file mode 100644 index 0000000000..9c65ea0331 --- /dev/null +++ b/include/phasar/PhasarLLVM/Passes.h @@ -0,0 +1,17 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_PASSES_H +#define PHASAR_PHASARLLVM_PASSES_H + +#include "phasar/PhasarLLVM/Passes/ExampleModulePass.h" +#include "phasar/PhasarLLVM/Passes/GeneralStatisticsAnalysis.h" +#include "phasar/PhasarLLVM/Passes/ValueAnnotationPass.h" + +#endif // PHASAR_PHASARLLVM_PASSES_H diff --git a/include/phasar/PhasarLLVM/Pointer.h b/include/phasar/PhasarLLVM/Pointer.h new file mode 100644 index 0000000000..220567251a --- /dev/null +++ b/include/phasar/PhasarLLVM/Pointer.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_POINTER_H +#define PHASAR_PHASARLLVM_POINTER_H + +#include "phasar/PhasarLLVM/Pointer/LLVMAliasGraph.h" +#include "phasar/PhasarLLVM/Pointer/LLVMAliasInfo.h" +#include "phasar/PhasarLLVM/Pointer/LLVMAliasSet.h" +#include "phasar/PhasarLLVM/Pointer/LLVMBasedAliasAnalysis.h" +#include "phasar/PhasarLLVM/Pointer/LLVMPointsToUtils.h" +#include "phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h" +#include "phasar/PhasarLLVM/Pointer/TypeGraphs/LazyTypeGraph.h" +#include "phasar/PhasarLLVM/Pointer/TypeGraphs/TypeGraph.h" + +#endif // PHASAR_PHASARLLVM_POINTER_H diff --git a/include/phasar/PhasarLLVM/TaintConfig.h b/include/phasar/PhasarLLVM/TaintConfig.h new file mode 100644 index 0000000000..5335aaf590 --- /dev/null +++ b/include/phasar/PhasarLLVM/TaintConfig.h @@ -0,0 +1,17 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_TAINTCONFIG_H +#define PHASAR_PHASARLLVM_TAINTCONFIG_H + +#include "phasar/PhasarLLVM/TaintConfig/LLVMTaintConfig.h" +#include "phasar/PhasarLLVM/TaintConfig/TaintConfigBase.h" +#include "phasar/PhasarLLVM/TaintConfig/TaintConfigUtilities.h" + +#endif // PHASAR_PHASARLLVM_TAINTCONFIG_H diff --git a/include/phasar/PhasarLLVM/TypeHierarchy.h b/include/phasar/PhasarLLVM/TypeHierarchy.h new file mode 100644 index 0000000000..a8a9b4d12b --- /dev/null +++ b/include/phasar/PhasarLLVM/TypeHierarchy.h @@ -0,0 +1,16 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_TYPEHIERARCHY_H +#define PHASAR_PHASARLLVM_TYPEHIERARCHY_H + +#include "phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h" +#include "phasar/PhasarLLVM/TypeHierarchy/LLVMVFTable.h" + +#endif // PHASAR_PHASARLLVM_TYPEHIERARCHY_H diff --git a/include/phasar/PhasarLLVM/Utils.h b/include/phasar/PhasarLLVM/Utils.h new file mode 100644 index 0000000000..cda1b77dc3 --- /dev/null +++ b/include/phasar/PhasarLLVM/Utils.h @@ -0,0 +1,21 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARLLVM_UTILS_H +#define PHASAR_PHASARLLVM_UTILS_H + +#include "phasar/PhasarLLVM/Utils/Annotation.h" +#include "phasar/PhasarLLVM/Utils/BasicBlockOrdering.h" +#include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h" +#include "phasar/PhasarLLVM/Utils/LLVMBasedContainerConfig.h" +#include "phasar/PhasarLLVM/Utils/LLVMCXXShorthands.h" +#include "phasar/PhasarLLVM/Utils/LLVMIRToSrc.h" +#include "phasar/PhasarLLVM/Utils/LLVMShorthands.h" + +#endif // PHASAR_PHASARLLVM_UTILS_H diff --git a/include/phasar/PhasarPass.h b/include/phasar/PhasarPass.h new file mode 100644 index 0000000000..2085f547e6 --- /dev/null +++ b/include/phasar/PhasarPass.h @@ -0,0 +1,18 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_PHASARPASS_H +#define PHASAR_PHASARPASS_H + +#include "PhasarPass/Options.h" +#include "PhasarPass/PhasarPass.h" +#include "PhasarPass/PhasarPrinterPass.h" +#include "PhasarPass/RegisterPasses.h" + +#endif // PHASAR_PHASARPASS_H diff --git a/include/phasar/Pointer.h b/include/phasar/Pointer.h new file mode 100644 index 0000000000..b7084ce40e --- /dev/null +++ b/include/phasar/Pointer.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_POINTER_H +#define PHASAR_POINTER_H + +#include "phasar/Pointer/AliasAnalysisType.h" +#include "phasar/Pointer/AliasInfo.h" +#include "phasar/Pointer/AliasInfoBase.h" +#include "phasar/Pointer/AliasInfoTraits.h" +#include "phasar/Pointer/AliasResult.h" +#include "phasar/Pointer/AliasSetOwner.h" +#include "phasar/Pointer/PointsToInfo.h" +#include "phasar/Pointer/PointsToInfoBase.h" + +#endif // PHASAR_POINTER_H diff --git a/include/phasar/TypeHierarchy.h b/include/phasar/TypeHierarchy.h new file mode 100644 index 0000000000..57d98d64cc --- /dev/null +++ b/include/phasar/TypeHierarchy.h @@ -0,0 +1,16 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_TYPEHIERARCHY_H +#define PHASAR_TYPEHIERARCHY_H + +#include "phasar/TypeHierarchy/TypeHierarchy.h" +#include "phasar/TypeHierarchy/VFTable.h" + +#endif // PHASAR_TYPEHIERARCHY_H diff --git a/include/phasar/Utils.h b/include/phasar/Utils.h new file mode 100644 index 0000000000..42049fb03c --- /dev/null +++ b/include/phasar/Utils.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#ifndef PHASAR_UTILS_H +#define PHASAR_UTILS_H + +#include "phasar/Utils/AnalysisProperties.h" +#include "phasar/Utils/BitVectorSet.h" +#include "phasar/Utils/BoxedPointer.h" +#include "phasar/Utils/ByRef.h" +#include "phasar/Utils/DOTGraph.h" +#include "phasar/Utils/DebugOutput.h" +#include "phasar/Utils/EnumFlags.h" +#include "phasar/Utils/EquivalenceClassMap.h" +#include "phasar/Utils/ErrorHandling.h" +#include "phasar/Utils/IO.h" +#include "phasar/Utils/JoinLattice.h" +#include "phasar/Utils/Logger.h" +#include "phasar/Utils/MaybeUniquePtr.h" +#include "phasar/Utils/MemoryResource.h" +#include "phasar/Utils/NlohmannLogging.h" +#include "phasar/Utils/Nullable.h" +#include "phasar/Utils/PAMMMacros.h" +#include "phasar/Utils/Printer.h" +#include "phasar/Utils/Soundness.h" +#include "phasar/Utils/StableVector.h" +#include "phasar/Utils/Table.h" +#include "phasar/Utils/TypeTraits.h" +#include "phasar/Utils/Utilities.h" + +#endif // PHASAR_UTILS_H diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c484c6e631..8f95cc4b07 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -8,3 +8,8 @@ add_subdirectory(Utils) add_subdirectory(Controller) add_subdirectory(Pointer) add_subdirectory(ControlFlow) + + +add_library(phasar STATIC + LibPhasar.cpp +) diff --git a/lib/LibPhasar.cpp b/lib/LibPhasar.cpp new file mode 100644 index 0000000000..97bbc811c2 --- /dev/null +++ b/lib/LibPhasar.cpp @@ -0,0 +1,10 @@ +/****************************************************************************** + * Copyright (c) 2023 Philipp Schubert. + * All rights reserved. This program and the accompanying materials are made + * available under the terms of LICENSE.txt. + * + * Contributors: + * Fabian Schiebel and others + *****************************************************************************/ + +#include "phasar.h" From fe5efec1de1c0b1c3923b9e2acde46bb703671c5 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 May 2023 21:06:30 +0200 Subject: [PATCH 2/8] Add build rules for building a fat lib --- CMakeLists.txt | 24 ++++++++++++-------- cmake/phasar_macros.cmake | 19 +--------------- lib/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f447abe60d..a020144182 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if (NOT PHASAR_IN_TREE) set(CMAKE_PROJECT_NAME "phasar") endif () -option(PHASAR_EXPERIMENTAL_CXX20 "Build phasar in C++20 mode. THis is an experimental feature" OFF) +option(PHASAR_EXPERIMENTAL_CXX20 "Build phasar in C++20 mode. This is an experimental feature" OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS YES) if(PHASAR_EXPERIMENTAL_CXX20) @@ -39,6 +39,7 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") else() message(STATUS "Selected Release Build") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # LTO endif() # Enable testing @@ -77,7 +78,12 @@ option(PHASAR_BUILD_DOC "Build documentation" OFF) option(PHASAR_DEBUG_LIBDEPS "Debug internal library dependencies (private linkage)" OFF) -option(BUILD_SHARED_LIBS "Build shared libraries (default is ON)" ON) +#option(BUILD_SHARED_LIBS "Build shared libraries (default is ON)" ON) +option(PHASAR_BUILD_DYLIB "Build one fat shared library. Requires BUILD_SHARED_LIBS to be turned OFF (default is OFF)" OFF) + +if(PHASAR_BUILD_DYLIB AND BUILD_SHARED_LIBS) + message(FATAL_ERROR "PHASAR_BUILD_DYLIB is incompatible with BUILD_SHARED_LIBS") +endif() option(PHASAR_ENABLE_WARNINGS "Enable warnings" ON) if (PHASAR_ENABLE_WARNINGS) @@ -156,7 +162,7 @@ find_package(Threads) # Boost find_package(Boost 1.65.1 COMPONENTS graph ${BOOST_THREAD} REQUIRED) #find_package(Boost 1.72.0 COMPONENTS graph ${BOOST_THREAD} REQUIRED) -include_directories(${Boost_INCLUDE_DIRS}) +include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) # Disable clang-tidy for the external projects set(CMAKE_CXX_CLANG_TIDY "") @@ -184,7 +190,7 @@ set(nlohmann_json_DIR ${PHASAR_SRC_DIR}/external/json/single_include/) # Json Schema Validator set(JSON_VALIDATOR_INSTALL ON) add_subdirectory(external/json-schema-validator) -include_directories(external/json-schema-validator/src/) +include_directories(SYSTEM external/json-schema-validator/src/) # now we finally add the subdirectory set(JSON_BuildTests OFF) @@ -194,8 +200,8 @@ add_subdirectory(external/json) # Googletest if (NOT PHASAR_IN_TREE) add_subdirectory(external/googletest EXCLUDE_FROM_ALL) - include_directories(external/googletest/googletest/include) - include_directories(external/googletest/googlemock/include) + include_directories(SYSTEM external/googletest/googletest/include) + include_directories(SYSTEM external/googletest/googlemock/include) else() # Set llvm distributed includes for gtest header include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) @@ -205,13 +211,13 @@ endif() # SQL find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h) find_library(SQLITE3_LIBRARY NAMES sqlite3) -include_directories(${SQLITE3_INCLUDE_DIR}) +include_directories(SYSTEM ${SQLITE3_INCLUDE_DIR}) # LLVM if (NOT PHASAR_IN_TREE) # Only search for LLVM if we build out of tree find_package(LLVM 14 REQUIRED CONFIG) - include_directories(${LLVM_INCLUDE_DIRS}) + include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) link_directories(${LLVM_LIB_PATH} ${LLVM_LIBRARY_DIRS}) endif() @@ -265,7 +271,7 @@ endif() if (PHASAR_IN_TREE) # Phasar needs clang headers, specificaly some that are generated by clangs table-gen - include_directories( + include_directories(SYSTEM ${CLANG_INCLUDE_DIR} ${PHASAR_SRC_DIR}/../clang/include ${PROJECT_BINARY_DIR}/tools/clang/include diff --git a/cmake/phasar_macros.cmake b/cmake/phasar_macros.cmake index 9fe7102f9c..db00964710 100644 --- a/cmake/phasar_macros.cmake +++ b/cmake/phasar_macros.cmake @@ -14,24 +14,7 @@ function(add_phasar_unittest test_name) target_link_libraries(${test} LINK_PUBLIC - phasar_config - phasar_controller - phasar_llvm_controlflow - phasar_controlflow - phasar_llvm_utils - phasar_analysis_strategy - phasar_llvm_ifdside - phasar_utils - phasar_mono - phasar_llvm_db - phasar_db - # phasar_clang - phasar_passes - phasar_llvm_pointer - phasar_pointer - phasar_llvm_typehierarchy - phasar_llvm - phasar_taintconfig + phasar nlohmann_json_schema_validator ${SQLITE3_LIBRARY} ${Boost_LIBRARIES} diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8f95cc4b07..bf030b7738 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -9,7 +9,50 @@ add_subdirectory(Controller) add_subdirectory(Pointer) add_subdirectory(ControlFlow) +set(PHASAR_LINK_LIBS + phasar_utils + phasar_passes + phasar_config + phasar_db + phasar_pointer + phasar_controlflow -add_library(phasar STATIC - LibPhasar.cpp + phasar_llvm_utils + phasar_llvm_db + phasar_llvm_pointer + phasar_llvm_typehierarchy + phasar_llvm_controlflow + + phasar_taintconfig + phasar_mono + phasar_llvm + phasar_llvm_ifdside + phasar_analysis_strategy + phasar_controller + ${Boost_LIBRARIES} +) + +set(LLVM_LINK_COMPONENTS + Core + Support + BitWriter + Analysis + Passes + Demangle ) + +# The fat lib relies on transitive dependencies... +set(PHASAR_DEBUG_LIBDEPS_SAVE ${PHASAR_DEBUG_LIBDEPS}) +set(PHASAR_DEBUG_LIBDEPS OFF) + +if(BUILD_SHARED_LIBS OR PHASAR_BUILD_DYLIB) + add_phasar_library(phasar SHARED + LibPhasar.cpp + ) +else() + add_phasar_library(phasar STATIC + LibPhasar.cpp + ) +endif() + +set(PHASAR_DEBUG_LIBDEPS ${PHASAR_DEBUG_LIBDEPS_SAVE}) From 2164e214036363af76c3ffdeb7233be80fad19ca Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 May 2023 21:50:16 +0200 Subject: [PATCH 3/8] Some docs --- BreakingChanges.md | 4 ++++ README.md | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/BreakingChanges.md b/BreakingChanges.md index 2d73d94c68..db9a42b633 100644 --- a/BreakingChanges.md +++ b/BreakingChanges.md @@ -1,5 +1,9 @@ # Breaking Changes +## Development HEAD + +- Default build mode is no longer `SHARED` but `STATIC`. To build in shared mode, use the cmake option `BUILD_SHARED_LIBS` which is not recommended. Consider using `PHASAR_BUILD_DYLIB` instead to build one big libphasar.so. + ## v0323 - `EdgeFunctionPtrType` is no longer a `std::shared_ptr`. Instead `EdgeFunction` should be used directly. `EdgeFunction` is now a *value-type* that encapsulates its memory management by itself. diff --git a/README.md b/README.md index 1c82c87c52..d4c61467ce 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ Required version of the C++ standard ------------------------------------ PhASAR requires C++-17. +However, building in C++20 mode is supported as experimental feature. Cou may enable this by turning the cmake option `PHASAR_EXPERIMENTAL_CXX20` on. +Although phasar currently does not make use of C++20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 ealier. + Currently supported version of LLVM ----------------------------------- PhASAR is currently set up to support LLVM-14.0. @@ -49,7 +52,8 @@ prerequisites and compilation. It is recommended to compile PhASAR yourself in order to get the full C++ experience and to have full control over the build mode. -As a shortcut for the very first PhASAR build on your system, you can use our [bootstrap](./bootstrap.sh) script: +As a shortcut for the very first PhASAR build on your system, you can use our [bootstrap](./bootstrap.sh) script. +Please note that you must have python installed for the script to work properly. ```bash $ ./bootstrap.sh @@ -173,7 +177,34 @@ If you obtain output other than a segmentation fault or an exception terminating How to use PhASAR? ------------------ -Please consult our [PhASAR wiki pages](https://github.com/secure-software-engineering/phasar/wiki). + +We recomment using phasar with `cmake`. + +If you already have installed phasar, [Use-PhASAR-as-a-library](https://github.com/secure-software-engineering/phasar/wiki/Using-Phasar-as-a-Library) may be a good start. + +Otherwise, we recommend adding PhASAR as a git submodule to your repository. +In this case, just `add_subdirectory` the phasar submodule directory and add phasar's include folder to your `include_directories`. + +Assuming you have checked out phasar in `external/phasar`, the phasar-related cmake commands may look like this: + +```cmake +set(PHASAR_BUILD_UNITTESTS OFF) # -- Don't build PhASAR's unittests with *your* tool +set(PHASAR_BUILD_IR OFF) # -- +add_subdirectories(external/phasar) # Build phasar with your tool +include_directories(external/phasar/include) # To find PhASAR's headers +link_libraries(nlohmann_json::nlohmann:json) # To find the json headers + +... + +target_link_libraries(yourphasartool + ... + phasar # Make your tool link against phasar +) +``` + +Depending on your use of PhASAR you also may need to add LLVM to your build. + +For more information please consult our [PhASAR wiki pages](https://github.com/secure-software-engineering/phasar/wiki). ### Installing PhASAR's Git pre-commit hook From 1519f5426da642b11b01315927b060deeb30a3b5 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 May 2023 21:50:44 +0200 Subject: [PATCH 4/8] Follow new practices in myphasartool --- .../Pointer/TypeGraphs/CachedTypeGraph.h | 5 +++- .../TypeHierarchy/LLVMTypeHierarchy.h | 7 +++-- tools/example-tool/CMakeLists.txt | 29 +------------------ tools/example-tool/myphasartool.cpp | 12 +------- .../TypeHierarchy/TypeGraphTest.cpp | 4 ++- 5 files changed, 14 insertions(+), 43 deletions(-) diff --git a/include/phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h b/include/phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h index 1931705cfb..3759c704c9 100644 --- a/include/phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h +++ b/include/phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h @@ -22,12 +22,15 @@ #include "boost/graph/adjacency_list.hpp" #include "boost/graph/graph_traits.hpp" #include "boost/graph/reverse_graph.hpp" -#include "gtest/gtest_prod.h" #include #include #include +#ifndef FRIEND_TEST +#define FRIEND_TEST(TEST, CLASS) +#endif + namespace llvm { class StructType; } // namespace llvm diff --git a/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h b/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h index 6024792d86..a2bd652d69 100644 --- a/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h +++ b/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h @@ -24,7 +24,6 @@ #include "boost/graph/adjacency_list.hpp" #include "boost/graph/graph_traits.hpp" -#include "gtest/gtest_prod.h" #include "nlohmann/json.hpp" #include @@ -34,6 +33,10 @@ #include #include +#ifndef FRIEND_TEST +#define FRIEND_TEST(TEST, CLASS) +#endif + namespace llvm { class Module; class StructType; @@ -132,7 +135,7 @@ class LLVMTypeHierarchy std::vector getVirtualFunctions(const llvm::Module &M, const llvm::StructType &Type); - // FRIEND_TEST(VTableTest, SameTypeDifferentVTables); + FRIEND_TEST(VTableTest, SameTypeDifferentVTables); FRIEND_TEST(LTHTest, GraphConstruction); FRIEND_TEST(LTHTest, HandleLoadAndPrintOfNonEmptyGraph); diff --git a/tools/example-tool/CMakeLists.txt b/tools/example-tool/CMakeLists.txt index 60cfbe1e82..aab2a9a7d6 100644 --- a/tools/example-tool/CMakeLists.txt +++ b/tools/example-tool/CMakeLists.txt @@ -11,40 +11,13 @@ else() ) endif() -find_package(Boost COMPONENTS graph ${BOOST_THREAD} REQUIRED) target_link_libraries(myphasartool LINK_PUBLIC - phasar_config - phasar_controller - phasar_db - phasar_llvm_db - phasar_llvm_controlflow - phasar_controlflow - phasar_llvm_ifdside - phasar_mono - phasar_passes - phasar_llvm_pointer - phasar_pointer - phasar_llvm_typehierarchy - phasar_llvm - phasar_llvm_utils - phasar_utils - ${Boost_LIBRARIES} - ${CMAKE_DL_LIBS} - ${CMAKE_THREAD_LIBS_INIT} + phasar LINK_PRIVATE ${PHASAR_STD_FILESYSTEM} ) -if(USE_LLVM_FAT_LIB) - llvm_config(myphasartool USE_SHARED ${LLVM_LINK_COMPONENTS}) -else() - llvm_config(myphasartool ${LLVM_LINK_COMPONENTS}) -endif() - -set(LLVM_LINK_COMPONENTS -) - install(TARGETS myphasartool RUNTIME DESTINATION bin LIBRARY DESTINATION lib diff --git a/tools/example-tool/myphasartool.cpp b/tools/example-tool/myphasartool.cpp index fbfc269c62..02ee6b2fcc 100644 --- a/tools/example-tool/myphasartool.cpp +++ b/tools/example-tool/myphasartool.cpp @@ -7,17 +7,7 @@ * Philipp Schubert and others *****************************************************************************/ -#include "phasar/ControlFlow/CallGraphAnalysisType.h" -#include "phasar/DataFlow/IfdsIde/Solver/IDESolver.h" -#include "phasar/DataFlow/IfdsIde/Solver/IFDSSolver.h" -#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h" -#include "phasar/PhasarLLVM/DB/LLVMProjectIRDB.h" -#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDELinearConstantAnalysis.h" -#include "phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IFDSSolverTest.h" -#include "phasar/PhasarLLVM/HelperAnalyses.h" -#include "phasar/PhasarLLVM/Pointer/LLVMAliasSet.h" -#include "phasar/PhasarLLVM/SimpleAnalysisConstructor.h" -#include "phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h" +#include "phasar.h" #include #include diff --git a/unittests/PhasarLLVM/TypeHierarchy/TypeGraphTest.cpp b/unittests/PhasarLLVM/TypeHierarchy/TypeGraphTest.cpp index 8f2f088e54..6fdc22e50c 100644 --- a/unittests/PhasarLLVM/TypeHierarchy/TypeGraphTest.cpp +++ b/unittests/PhasarLLVM/TypeHierarchy/TypeGraphTest.cpp @@ -1,3 +1,6 @@ +#include "gtest/gtest.h" +// -- Need gtest for the FRIEND_TEST macro + #include "phasar/Config/Configuration.h" #include "phasar/PhasarLLVM/DB/LLVMProjectIRDB.h" #include "phasar/PhasarLLVM/Pointer/TypeGraphs/CachedTypeGraph.h" @@ -9,7 +12,6 @@ #include "TestConfig.h" #include "boost/graph/isomorphism.hpp" -#include "gtest/gtest.h" using namespace std; using namespace psr; From 5190e0013fec95e0c7e7243430a2d787707412c4 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Fri, 26 May 2023 11:32:12 +0200 Subject: [PATCH 5/8] Update docs --- BreakingChanges.md | 30 ++-- CMakeLists.txt | 27 +++- README.md | 138 +++++++++--------- examples/use-phasar-as-library/CMakeLists.txt | 1 - examples/use-phasar-as-library/README.md | 7 +- lib/CMakeLists.txt | 2 +- 6 files changed, 115 insertions(+), 90 deletions(-) diff --git a/BreakingChanges.md b/BreakingChanges.md index db9a42b633..477de93b74 100644 --- a/BreakingChanges.md +++ b/BreakingChanges.md @@ -2,32 +2,32 @@ ## Development HEAD -- Default build mode is no longer `SHARED` but `STATIC`. To build in shared mode, use the cmake option `BUILD_SHARED_LIBS` which is not recommended. Consider using `PHASAR_BUILD_DYLIB` instead to build one big libphasar.so. +- Default build mode is no longer `SHARED` but `STATIC`. To build in shared mode, use the cmake option `BUILD_SHARED_LIBS` which we don't recommend anymore. Consider using `PHASAR_BUILD_DYNLIB` instead to build one big libphasar.so. ## v0323 - `EdgeFunctionPtrType` is no longer a `std::shared_ptr`. Instead `EdgeFunction` should be used directly. `EdgeFunction` is now a *value-type* that encapsulates its memory management by itself. - Concrete `EdgeFunction` types no longer derive from any base-class. Instead they just need to implement the required API functions. `EdgeFunction` implementations should me move-constructible and can be implicitly cast to `EdgeFunction`. To verify that your type implements the edge function interface use the `IsEdgeFunction` type trait. The API functions have been changed as follows: - - All API functions of `EdgeFunction` must be `const` qualified. - - `EdgeFunctionPtrType composeWith(EdgeFunctionPtrType SecondFunction)` and `EdgeFunctionPtrType joinWith(EdgeFunctionPtrType OtherFunction)` have been changed to `static EdgeFunction compose(EdgeFunctionRef This, const EdgeFunction& SecondFunction)` and `static EdgeFunction join(EdgeFunctionRef This, const EdgeFunction& OtherFunction)` respectively. Here, the `This` parameter models the former `shared_from_this()`. - - `bool equal_to(EdgeFunctionPtrType Other)const` has been changed to `bool operator==(const T &Other)const noexcept`, where `T` is your concrete edge function type. - - `void print(llvm::raw_ostream &OS, bool IsForDebug)` has been changed to `friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const T& EF)`. + - All API functions of `EdgeFunction` must be `const` qualified. + - `EdgeFunctionPtrType composeWith(EdgeFunctionPtrType SecondFunction)` and `EdgeFunctionPtrType joinWith(EdgeFunctionPtrType OtherFunction)` have been changed to `static EdgeFunction compose(EdgeFunctionRef This, const EdgeFunction& SecondFunction)` and `static EdgeFunction join(EdgeFunctionRef This, const EdgeFunction& OtherFunction)` respectively. Here, the `This` parameter models the former `shared_from_this()`. + - `bool equal_to(EdgeFunctionPtrType Other)const` has been changed to `bool operator==(const T &Other)const noexcept`, where `T` is your concrete edge function type. + - `void print(llvm::raw_ostream &OS, bool IsForDebug)` has been changed to `friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const T& EF)`. - `EdgeFunction` is tagged with `[[clang::trivial_abi]]`. Hence, you should not rely on any destruction order within a top-level statement that uses temporary `EdgeFunction` objects. - `EdgeFunctionSingletonFactory` has been removed. Use `EdgeFunctionSingletonCache` instead. - `TaintConfig` has been renamed to `LLVMTaintConfig`. For generic code you may want to use the LLVM-independent `TaintConfigBase` CRTP interface instead. - Renamed `phasar/PhasarLLVM/DataFlowSolver/` to either `phasar/DataFlow/` or `phasar/PhasarLLVM/DataFlow/` depending on whether the components need LLVMCore. Analoguous changes in `lib/` and `unittests/`. An incomplete list of moved/renamed files: - - `phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/*` => `phasar/DataFlow/IfdsIde/Solver/*` - - `phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IDETabulationProblem.h` => `phasar/DataFlow/IfdsIde/IDETabulationProblem.h` - - `phasar/DB/LLVMProjectIRDB.h` => `phasar/PhasarLLVM/DB/LLVMProjectIRDB.h` - - ... + - `phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/*` => `phasar/DataFlow/IfdsIde/Solver/*` + - `phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IDETabulationProblem.h` => `phasar/DataFlow/IfdsIde/IDETabulationProblem.h` + - `phasar/DB/LLVMProjectIRDB.h` => `phasar/PhasarLLVM/DB/LLVMProjectIRDB.h` + - ... - Renamed and split up some libraries: - - `phasar_phasarllvm_utils` => `phasar_llvm_utils` - - `phasar_typehierarchy` => `phasar_llvm_typehierarchy` - - `phasar_ifdside` => `phasar_llvm_ifdside` - - `phasar_controlflow` has its LLVM dependent stuff moved to `phasar_llvm_controlflow` - - `phasar_db` has its LLVM dependent stuff moved to `phasar_llvm_db` - - `phasar_pointer` has its LLVM dependent stuff moved to `phasar_llvm_pointer` + - `phasar_phasarllvm_utils` => `phasar_llvm_utils` + - `phasar_typehierarchy` => `phasar_llvm_typehierarchy` + - `phasar_ifdside` => `phasar_llvm_ifdside` + - `phasar_controlflow` has its LLVM dependent stuff moved to `phasar_llvm_controlflow` + - `phasar_db` has its LLVM dependent stuff moved to `phasar_llvm_db` + - `phasar_pointer` has its LLVM dependent stuff moved to `phasar_llvm_pointer` - Renamed the phasar tool `phasar-llvm` to `phasar-cli` - `LLVMPointsTo[.*]` has been renamed to `LLVMAlias[.*]` - The ctor of `LLVMAliasSet` now takes the `LLVMProjectIRDB` as pointer instead of a reference to better document that it may capture the IRDB by reference. diff --git a/CMakeLists.txt b/CMakeLists.txt index a020144182..de6a78b1dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,8 @@ -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.9) + +# Avoid IPO/LTO Warnings: +cmake_policy(SET CMP0069 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # Check if we build within the llvm source tree if (DEFINED LLVM_MAIN_SRC_DIR) @@ -38,8 +42,21 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe -g") else() message(STATUS "Selected Release Build") + + include(CheckIPOSupported) + check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT LTO_SUPPORT_ERROR) + + + if(LTO_SUPPORTED) + message(STATUS "IPO/LTO enabled") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # LTO + else() + message(STATUS "IPO/LTO not supported: ${LTO_SUPPORT_ERROR}") + endif() + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe") - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # LTO + endif() # Enable testing @@ -79,10 +96,10 @@ option(PHASAR_BUILD_DOC "Build documentation" OFF) option(PHASAR_DEBUG_LIBDEPS "Debug internal library dependencies (private linkage)" OFF) #option(BUILD_SHARED_LIBS "Build shared libraries (default is ON)" ON) -option(PHASAR_BUILD_DYLIB "Build one fat shared library. Requires BUILD_SHARED_LIBS to be turned OFF (default is OFF)" OFF) +option(PHASAR_BUILD_DYNLIB "Build one fat shared library. Requires BUILD_SHARED_LIBS to be turned OFF (default is OFF)" OFF) -if(PHASAR_BUILD_DYLIB AND BUILD_SHARED_LIBS) - message(FATAL_ERROR "PHASAR_BUILD_DYLIB is incompatible with BUILD_SHARED_LIBS") +if(PHASAR_BUILD_DYNLIB AND BUILD_SHARED_LIBS) + message(FATAL_ERROR "PHASAR_BUILD_DYNLIB is incompatible with BUILD_SHARED_LIBS") endif() option(PHASAR_ENABLE_WARNINGS "Enable warnings" ON) diff --git a/README.md b/README.md index d4c61467ce..b88f353190 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,49 @@ ![PhASAR logo](img/Logo_RGB/Phasar_Logo.png) -PhASAR a LLVM-based Static Analysis Framework -============================================= +# PhASAR a LLVM-based Static Analysis Framework [![C++ Standard](https://img.shields.io/badge/C++_Standard-C%2B%2B17-blue.svg?style=flat&logo=c%2B%2B)](https://isocpp.org/) [![GitHub license](https://img.shields.io/badge/license-MIT-blueviolet.svg)](https://raw.githubusercontent.com/secure-software-engineering/phasar/master/LICENSE.txt) Version 0323 -Secure Software Engineering Group ---------------------------------- +## Secure Software Engineering Group -+ Fabian Schiebel (fabian.schiebel@iem.fraunhofer.de), Martin Mory (martin.mory@upb.de), Philipp Dominik Schubert (philipp.schubert@upb.de) and others -+ Please also refer to https://phasar.org/ ++ Fabian Schiebel (), Martin Mory (), Philipp Dominik Schubert () and others ++ Please also refer to + +## Required version of the C++ standard -Required version of the C++ standard ------------------------------------- PhASAR requires C++-17. -However, building in C++20 mode is supported as experimental feature. Cou may enable this by turning the cmake option `PHASAR_EXPERIMENTAL_CXX20` on. +However, building in C++20 mode is supported as experimental feature. You may enable this by turning the cmake option `PHASAR_EXPERIMENTAL_CXX20` on. Although phasar currently does not make use of C++20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 ealier. -Currently supported version of LLVM ------------------------------------ +## Currently supported version of LLVM + PhASAR is currently set up to support LLVM-14.0. -What is PhASAR? ---------------- +## What is PhASAR? + PhASAR is a LLVM-based static analysis framework written in C++. It allows users to specify arbitrary data-flow problems which are then solved in a fully-automated manner on the specified LLVM IR target code. Computing points-to information, call-graph(s), etc. is done by the framework, thus you can focus on what matters. -Breaking Changes ----------------- +## Breaking Changes + To keep PhASAR in a state that it is well suited for state-of-the-art research in static analysis, as well as for productive use, we have to make breaking changes. Please refer to [Breaking Changes](./BreakingChanges.md) for detailed information on what was broken recently and how to migrate. -How do I get started with PhASAR? ---------------------------------- -We have some documentation on PhASAR in our [_**Wiki**_](https://github.com/secure-software-engineering/phasar/wiki). You probably would like to read -this README first and then have a look on the material provided on https://phasar.org/ +## How do I get started with PhASAR? + +We have some documentation on PhASAR in our [***Wiki***](https://github.com/secure-software-engineering/phasar/wiki). You probably would like to read +this README first and then have a look on the material provided on as well. Please also have a look on PhASAR's project directory and notice the project directory examples/ as well as the custom tool tools/myphasartool.cpp. -Building PhASAR ---------------- +## Building PhASAR + If you cannot work with one of the pre-built versions of PhASAR and would like to compile PhASAR yourself, then please check the wiki for installing the prerequisites and compilation. It is recommended to compile PhASAR yourself in @@ -56,87 +54,91 @@ As a shortcut for the very first PhASAR build on your system, you can use our [b Please note that you must have python installed for the script to work properly. ```bash -$ ./bootstrap.sh +./bootstrap.sh ``` Note: If you want to do changes within PhASAR, it is recommended to build it in Debug mode: + ```bash -$ ./bootstrap.sh -DCMAKE_BUILD_TYPE=Debug +./bootstrap.sh -DCMAKE_BUILD_TYPE=Debug ``` The bootstrap script may ask for superuser permissions (to install the dependencies); however it is not recommended to start the whole script with `sudo`. For subsequent builds, see [Compiling PhASAR](#compiling-phasar-if-not-already-done-using-the-installation-scripts). -Please help us to improve PhASAR --------------------------------- +## Please help us to improve PhASAR + You are using PhASAR and would like to help us in the future? Then please support us by filling out this [web form](https://goo.gl/forms/YG6m3M7sxeUJmKyi1). By giving us feedback you help to decide in what direction PhASAR should stride in the future and give us clues about our user base. Thank you very much! +## Installation -Installation ------------- PhASAR can be installed using the installer scripts as explained in the following. - ### Installing PhASAR on an Ubuntu system + In the following, we would like to give an complete example of how to install PhASAR using an Ubuntu or Unix-like system. Therefore, we provide an installation script. To install PhASAR, just navigate to the top-level directory of PhASAR and use the following command: + ```bash -$ ./bootstrap.sh --install +./bootstrap.sh --install ``` The bootstrap script may ask for superuser permissions. Done! - ### Installing PhASAR a MacOS system + Due to unfortunate updates to MacOS and the handling of C++, especially on the newer M1 processors, we can't support native development on Mac. The easiest solution to develop PhASAR on a Mac right now is to use [dockers development environments](https://docs.docker.com/desktop/dev-environments/). Clone this repository as described in their documentation. Afterwards, you have to login once manually, as a root user by running `docker exec -it -u root /bin/bash` to complete the rest of the install process as described in this readme (install submodules, run bootstrap.sh, ...). Now you can just attach your docker container to VS Code or any other IDE, which supports remote development. ### Compiling PhASAR (if not already done using the installation scripts) + Set the system's variables for the C and C++ compiler to clang: + +```bash +export CC=/usr/local/bin/clang +export CXX=/usr/local/bin/clang++ ``` -$ export CC=/usr/local/bin/clang -$ export CXX=/usr/local/bin/clang++ -``` + You may need to adjust the paths according to your system. When you cloned PhASAR from Github you need to initialize PhASAR's submodules before building it: -``` -$ git submodule update --init +```bash +git submodule update --init ``` If you downloaded PhASAR as a compressed release (e.g. .zip or .tar.gz) you can use the `init-submodules-release.sh` script that manually clones the required submodules: -``` -$ utils/init-submodules-release.sh +```bash +utils/init-submodules-release.sh ``` Navigate into the PhASAR directory. The following commands will do the job and compile the PhASAR framework: -``` -$ mkdir build -$ cd build/ -$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. -$ ninja -j $(nproc) # or use a different number of cores to compile it -$ sudo ninja install # only if you wish to install PhASAR system wide +```bash +mkdir build +cd build/ +cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. +ninja -j $(nproc) # or use a different number of cores to compile it +sudo ninja install # only if you wish to install PhASAR system wide ``` When you have used the `bootstrap.sh` script to install PhASAR, the above steps are already done. 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: +After compilation using cmake the following two binaries can be found in the build/tools directory: -+ 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 ++ `phasar-cli` - the PhASAR command-line tool (previously called `phasar-llvm`) that provides access to analyses that are already implemented within PhASAR. Use this if you don't want to build an own tool on top of PhASAR. ++ `myphasartool` - an example tool that shows how tools can be build on top of PhASAR Use the command: @@ -150,40 +152,43 @@ When using CMake to compile PhASAR the following optional parameters can be used | Parameter : Type| Effect | |-----------|--------| -| BUILD_SHARED_LIBS : BOOL | Build shared libraries (default is ON) | -| CMAKE_BUILD_TYPE : STRING | Build PhASAR in 'Debug' or 'Release' mode
(default is 'Debug') | -| CMAKE_INSTALL_PREFIX : PATH | Path where PhASAR will be installed if
"ninja install” is invoked or the “install”
target is built (default is /usr/local/phasar) | -| PHASAR_CONFIG_INSTALL_PREFIX : PATH | Path where PhASAR's configuration files will be installed if
ninja install” is invoked or the “install”
target is built. Expression will be evaluated within CMAKE_INSTALL_PREFIX, so prefer absolute paths (default is $(HOME)/.config/) | -| PHASAR_BUILD_DOC : BOOL | Build PhASAR documentation (default is OFF) | -| PHASAR_BUILD_UNITTESTS : BOOL | Build PhASAR unit tests (default is ON) | -| PHASAR_BUILD_IR : BOOL | Build PhASAR IR (required for running the unit tests) (default is ON) | -| PHASAR_BUILD_OPENSSL_TS_UNITTESTS : BOOL | Build PhASAR unit tests that require OpenSSL (default is OFF) | -| PHASAR_ENABLE_PAMM : STRING | Enable the performance measurement mechanism
('Off', 'Core' or 'Full', default is Off) | -| PHASAR_ENABLE_PIC : BOOL | Build Position-Independed Code (default is ON) | -| PHASAR_ENABLE_WARNINGS : BOOL | Enable compiler warnings (default is ON) | +| **BUILD_SHARED_LIBS** : BOOL | Build shared libraries -- Not recommended anymore. You may want to use PHASAR_BUILD_DYNLIB instead (default is OFF) | +| **PHASAR_BUILD_DYNLIB** : BOOL | Build one fat shared library (default is OFF) | +| **CMAKE_BUILD_TYPE** : STRING | Build PhASAR in 'Debug', 'RelWithDebInfo' or 'Release' mode (default is 'Debug') | +| **CMAKE_INSTALL_PREFIX** : PATH | Path where PhASAR will be installed if "ninja install” is invoked or the “install” target is built (default is /usr/local/phasar) | +| **PHASAR_CUSTOM_CONFIG_INSTALL_DIR** : PATH | If set, customizes the directory, where configuration files for PhASAR are installed (default is /usr/local/.phasar-config)| +| **PHASAR_ENABLE_DYNAMIC_LOG** : BOOL|Makes it possible to switch the logger on and off at runtime (default is ON)| +| **PHASAR_BUILD_DOC** : BOOL | Build PhASAR documentation (default is OFF) | +| **PHASAR_BUILD_UNITTESTS** : BOOL | Build PhASAR unit tests (default is ON) | +| **PHASAR_BUILD_IR** : BOOL | Build PhASAR IR (required for running the unit tests) (default is ON) | +| **PHASAR_BUILD_OPENSSL_TS_UNITTESTS** : BOOL | Build PhASAR unit tests that require OpenSSL (default is OFF) | +| **PHASAR_ENABLE_PAMM** : STRING | Enable the performance measurement mechanism ('Off', 'Core' or 'Full', default is Off) | +| **PHASAR_ENABLE_PIC** : BOOL | Build Position-Independed Code (default is ON) | +| **PHASAR_ENABLE_WARNINGS** : BOOL | Enable compiler warnings (default is ON) | +| **PHASAR_EXPERIMENTAL_CXX20** : BOOL|Build phasar in C++20 mode. This is an experimental feature (default is OFF)| You can use these parameters either directly or modify the installer-script `bootstrap.sh` #### A remark on compile time -C++'s long compile times are always a pain. As shown in the above, when using cmake the compilation can easily be run in parallel, resulting in shorter compilation times. Make use of it! +C++'s long compile times are always a pain. As shown in the above, when using cmake the compilation can easily be run in parallel, resulting in shorter compilation times. Make use of it! ### Running a test solver + To test if everything works as expected please run the following command: `$ 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. -How to use PhASAR? ------------------- +## How to use PhASAR? -We recomment using phasar with `cmake`. +We recomment using phasar as a library with `cmake`. If you already have installed phasar, [Use-PhASAR-as-a-library](https://github.com/secure-software-engineering/phasar/wiki/Using-Phasar-as-a-Library) may be a good start. Otherwise, we recommend adding PhASAR as a git submodule to your repository. -In this case, just `add_subdirectory` the phasar submodule directory and add phasar's include folder to your `include_directories`. +In this case, just `add_subdirectory` the phasar submodule directory and add phasar's include folder to your `include_directories` within your `CMakeLists.txt`. Assuming you have checked out phasar in `external/phasar`, the phasar-related cmake commands may look like this: @@ -206,18 +211,17 @@ Depending on your use of PhASAR you also may need to add LLVM to your build. For more information please consult our [PhASAR wiki pages](https://github.com/secure-software-engineering/phasar/wiki). - ### Installing PhASAR's Git pre-commit hook + You are very much welcome to contribute to the PhASAR project. Please make sure that you install our pre-commit hook that ensures your commit adheres to the most important coding rules of the PhASAR project. For more details please consult [Coding Conventions](https://github.com/secure-software-engineering/phasar/wiki/Coding-Conventions) and [Contributing to PhASAR](https://github.com/secure-software-engineering/phasar/wiki/Contributing-to-PhASAR). To install the pre-commit hook, please run the following commands in PhASAR's root directory: -``` -$ pip install pre-commit -$ pre-commit install - +```bash +pip install pre-commit +pre-commit install ``` Thanks. And have fun with the project. diff --git a/examples/use-phasar-as-library/CMakeLists.txt b/examples/use-phasar-as-library/CMakeLists.txt index 6a2ac73bfb..bba4e8e6d0 100644 --- a/examples/use-phasar-as-library/CMakeLists.txt +++ b/examples/use-phasar-as-library/CMakeLists.txt @@ -19,7 +19,6 @@ link_directories(${PHASAR_LIBRARY_DIR}) phasar_config(myphasartool) - install(TARGETS myphasartool RUNTIME DESTINATION bin LIBRARY DESTINATION lib diff --git a/examples/use-phasar-as-library/README.md b/examples/use-phasar-as-library/README.md index 46aa31cb6e..44dbce6ea8 100644 --- a/examples/use-phasar-as-library/README.md +++ b/examples/use-phasar-as-library/README.md @@ -1 +1,6 @@ -This is a demo tool that uses PhASAR as a library. The number of phasar libraries explicitly stated in CMakeLists.txt can be further reduced by stating the non-transitive dependencies of phasar libraries. This is pending work on the PhASAR side. +# Use PhASAR as a Library + +This small example shows how you can setup a CMake project that uses PhASAR as a library. +This guide assumes that you have installed PhASAR such that the `find_package` cmake command can find it. + +You can choose the PhASAR components that you need in the `find_package` command. diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index bf030b7738..2045abbfef 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -45,7 +45,7 @@ set(LLVM_LINK_COMPONENTS set(PHASAR_DEBUG_LIBDEPS_SAVE ${PHASAR_DEBUG_LIBDEPS}) set(PHASAR_DEBUG_LIBDEPS OFF) -if(BUILD_SHARED_LIBS OR PHASAR_BUILD_DYLIB) +if(BUILD_SHARED_LIBS OR PHASAR_BUILD_DYNLIB) add_phasar_library(phasar SHARED LibPhasar.cpp ) From a11fe889a67b59c529b21d3c2ee119ad8f6df36e Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Fri, 26 May 2023 13:37:44 +0200 Subject: [PATCH 6/8] minor in docs + pre-commit --- CMakeLists.txt | 4 ++-- README.md | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de6a78b1dd..42e842e312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.9) # Avoid IPO/LTO Warnings: -cmake_policy(SET CMP0069 NEW) +cmake_policy(SET CMP0069 NEW) set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # Check if we build within the llvm source tree @@ -56,7 +56,7 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -fvisibility-inlines-hidden -fstack-protector-strong -ffunction-sections -fdata-sections -pipe") - + endif() # Enable testing diff --git a/README.md b/README.md index b88f353190..e3413a4ae8 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,11 @@ Version 0323 ## Secure Software Engineering Group -+ Fabian Schiebel (), Martin Mory (), Philipp Dominik Schubert () and others -+ Please also refer to +PhASAR is primarily developed and maintained by the Secure Software Engineering Group at Heinz Nixdorf Institute (University of Paderborn) and Fraunhofer IEM. + +Lead developers of PhASAR are: Fabian Schiebel (@fabianbs96)(), Martin Mory (@MMory)(), Philipp Dominik Schubert (@pdschubert)() and others. + + ## Required version of the C++ standard @@ -21,7 +24,7 @@ Although phasar currently does not make use of C++20 features (except for some ` ## Currently supported version of LLVM -PhASAR is currently set up to support LLVM-14.0. +PhASAR is currently set up to support LLVM-14.0.* ## What is PhASAR? @@ -38,17 +41,15 @@ To keep PhASAR in a state that it is well suited for state-of-the-art research i ## How do I get started with PhASAR? We have some documentation on PhASAR in our [***Wiki***](https://github.com/secure-software-engineering/phasar/wiki). You probably would like to read -this README first and then have a look on the material provided on -as well. Please also have a look on PhASAR's project directory and notice the project directory -examples/ as well as the custom tool tools/myphasartool.cpp. +this README first. + +Please also have a look on PhASAR's project directory and notice the project directory `examples/` as well as the custom tool `tools/example-tool/myphasartool.cpp`. ## Building PhASAR -If you cannot work with one of the pre-built versions of PhASAR and would like to -compile PhASAR yourself, then please check the wiki for installing the -prerequisites and compilation. It is recommended to compile PhASAR yourself in -order to get the full C++ experience and to have full control over the build -mode. +It is recommended to compile PhASAR yourself in order to get the full C++ experience and to have full control over the build mode. +However, you may also want to try out one of the pre-built versions of PhASAR or the Docker container. As a shortcut for the very first PhASAR build on your system, you can use our [bootstrap](./bootstrap.sh) script. Please note that you must have python installed for the script to work properly. @@ -177,7 +178,7 @@ C++'s long compile times are always a pain. As shown in the above, when using cm To test if everything works as expected please run the following command: -`$ phasar-cli -m test/build_systems_tests/installation_tests/module.ll -D ifds-solvertest` +`$ phasar-cli -m test/llvm_test_code/basic/module_cpp.ll -D ifds-solvertest` If you obtain output other than a segmentation fault or an exception terminating the program abnormally everything works as expected. From 541b042b2b63aeab58ed8044d50916f69ac1e03e Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Wed, 31 May 2023 16:06:25 +0200 Subject: [PATCH 7/8] Changes according to review --- README.md | 4 ++-- include/phasar.h | 2 +- include/phasar/AnalysisStrategy.h | 2 +- include/phasar/Config.h | 2 +- include/phasar/ControlFlow.h | 2 +- include/phasar/Controller.h | 2 +- include/phasar/DB.h | 2 +- include/phasar/DataFlow.h | 2 +- include/phasar/Domain.h | 2 +- include/phasar/PhasarClang.h | 2 +- include/phasar/PhasarLLVM.h | 2 +- include/phasar/PhasarLLVM/Pointer/TypeGraphs/LazyTypeGraph.h | 1 - include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h | 1 - include/phasar/PhasarPass.h | 2 +- include/phasar/Pointer.h | 2 +- include/phasar/TypeHierarchy.h | 2 +- include/phasar/Utils.h | 2 +- 17 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e3413a4ae8..8e27e018aa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Lead developers of PhASAR are: Fabian Schiebel (@fabianbs96)( #include diff --git a/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h b/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h index a2bd652d69..51b0e853f7 100644 --- a/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h +++ b/include/phasar/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchy.h @@ -135,7 +135,6 @@ class LLVMTypeHierarchy std::vector getVirtualFunctions(const llvm::Module &M, const llvm::StructType &Type); - FRIEND_TEST(VTableTest, SameTypeDifferentVTables); FRIEND_TEST(LTHTest, GraphConstruction); FRIEND_TEST(LTHTest, HandleLoadAndPrintOfNonEmptyGraph); diff --git a/include/phasar/PhasarPass.h b/include/phasar/PhasarPass.h index 2085f547e6..aa8eb9b985 100644 --- a/include/phasar/PhasarPass.h +++ b/include/phasar/PhasarPass.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2023 Philipp Schubert. + * Copyright (c) 2023 Fabian Schiebel. * All rights reserved. This program and the accompanying materials are made * available under the terms of LICENSE.txt. * diff --git a/include/phasar/Pointer.h b/include/phasar/Pointer.h index b7084ce40e..def25c239d 100644 --- a/include/phasar/Pointer.h +++ b/include/phasar/Pointer.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2023 Philipp Schubert. + * Copyright (c) 2023 Fabian Schiebel. * All rights reserved. This program and the accompanying materials are made * available under the terms of LICENSE.txt. * diff --git a/include/phasar/TypeHierarchy.h b/include/phasar/TypeHierarchy.h index 57d98d64cc..d49fab3673 100644 --- a/include/phasar/TypeHierarchy.h +++ b/include/phasar/TypeHierarchy.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2023 Philipp Schubert. + * Copyright (c) 2023 Fabian Schiebel. * All rights reserved. This program and the accompanying materials are made * available under the terms of LICENSE.txt. * diff --git a/include/phasar/Utils.h b/include/phasar/Utils.h index 42049fb03c..f120b4faa0 100644 --- a/include/phasar/Utils.h +++ b/include/phasar/Utils.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2023 Philipp Schubert. + * Copyright (c) 2023 Fabian Schiebel. * All rights reserved. This program and the accompanying materials are made * available under the terms of LICENSE.txt. * From 83c5d6675869bbc7da764257bb39ea90241ab005 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Wed, 31 May 2023 18:10:32 +0200 Subject: [PATCH 8/8] Add CG to ControlFlow.h --- include/phasar/ControlFlow.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/phasar/ControlFlow.h b/include/phasar/ControlFlow.h index 77a6dcbe7c..b820c0ec0e 100644 --- a/include/phasar/ControlFlow.h +++ b/include/phasar/ControlFlow.h @@ -11,7 +11,9 @@ #define PHASAR_CONTROLFLOW_H #include "phasar/ControlFlow/CFGBase.h" +#include "phasar/ControlFlow/CallGraph.h" #include "phasar/ControlFlow/CallGraphAnalysisType.h" +#include "phasar/ControlFlow/CallGraphBase.h" #include "phasar/ControlFlow/ICFGBase.h" #include "phasar/ControlFlow/SpecialMemberFunctionType.h"