Skip to content

Commit 7a39346

Browse files
author
Martin Mory
committed
remove code depenencies to boost::filesystem
1 parent 90fafd8 commit 7a39346

37 files changed

Lines changed: 83 additions & 102 deletions

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ endif()
125125
find_package(Threads)
126126

127127
# Boost
128-
find_package(Boost 1.65.1 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED)
129-
#find_package(Boost 1.72.0 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED)
128+
find_package(Boost 1.65.1 COMPONENTS graph system program_options log ${BOOST_THREAD} REQUIRED)
129+
#find_package(Boost 1.72.0 COMPONENTS graph system program_options log ${BOOST_THREAD} REQUIRED)
130130
include_directories(${Boost_INCLUDE_DIRS})
131131

132132
# Disable clang-tidy for the external projects
@@ -408,7 +408,6 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MIN
408408
# better use autogenerated dependency information
409409
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
410410
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost_program_options (>= 1.66.0),
411-
# libboost_filesystem (>= 1.66.0),
412411
# libboost_graph (>= 1.66.0),
413412
# libboost_system (>= 1.66.0),
414413
# libboost_log (>= 1.66.0),

examples/use-phasar-as-library/myphasartool.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* Philipp Schubert and others
88
*****************************************************************************/
99

10+
#include <filesystem>
1011
#include <fstream>
1112
#include <iostream>
1213

13-
#include "boost/filesystem/operations.hpp"
14-
1514
#include "phasar/DB/ProjectIRDB.h"
1615
#include "phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h"
1716
#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h"
@@ -30,8 +29,8 @@ class Value;
3029
using namespace psr;
3130

3231
int main(int argc, const char **argv) {
33-
if (argc < 2 || !boost::filesystem::exists(argv[1]) ||
34-
boost::filesystem::is_directory(argv[1])) {
32+
if (argc < 2 || !std::filesystem::exists(argv[1]) ||
33+
std::filesystem::is_directory(argv[1])) {
3534
std::cerr << "myphasartool\n"
3635
"A small PhASAR-based example program\n\n"
3736
"Usage: myphasartool <LLVM IR file>\n";

include/phasar/Config/Configuration.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#define PHASAR_CONFIG_CONFIGURATION_H_
1919

2020
#include <string>
21+
#include <filesystem>
2122

22-
#include "boost/filesystem.hpp"
2323
#include "boost/program_options.hpp"
2424

2525
#include "llvm/ADT/iterator_range.h"
@@ -129,8 +129,8 @@ class PhasarConfig {
129129
std::string ConfigFolder = "config/";
130130
if (EnvHome) { // Check if HOME was defined in the environment
131131
std::string PhasarConfDir = std::string(EnvHome) + "/.config/phasar/";
132-
if (boost::filesystem::exists(PhasarConfDir) &&
133-
boost::filesystem::is_directory(PhasarConfDir)) {
132+
if (std::filesystem::exists(PhasarConfDir) &&
133+
std::filesystem::is_directory(PhasarConfDir)) {
134134
ConfigFolder = PhasarConfDir;
135135
}
136136
}

include/phasar/Controller/AnalysisController.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <string>
1616
#include <vector>
1717

18-
#include "boost/filesystem.hpp"
1918

2019
#include "phasar/DB/ProjectIRDB.h"
2120
#include "phasar/PhasarLLVM/AnalysisStrategy/Strategies.h"
@@ -62,7 +61,7 @@ class AnalysisController {
6261
AnalysisControllerEmitterOptions::None;
6362
std::string ProjectID;
6463
std::string OutDirectory;
65-
boost::filesystem::path ResultDirectory;
64+
std::filesystem::path ResultDirectory;
6665
IFDSIDESolverConfig SolverConfig;
6766
[[maybe_unused]] Soundness SoundnessLevel;
6867
[[maybe_unused]] bool AutoGlobalSupport;

lib/Config/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ else()
1616
)
1717
endif()
1818

19-
find_package(Boost COMPONENTS filesystem program_options REQUIRED)
19+
find_package(Boost COMPONENTS program_options REQUIRED)
2020

2121
target_link_libraries(phasar_config
2222
LINK_PUBLIC

lib/Config/Configuration.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "boost/algorithm/string/classification.hpp"
2020
#include "boost/algorithm/string/split.hpp"
21-
#include "boost/filesystem.hpp"
2221

2322
#include "phasar/Config/Configuration.h"
2423
#include "phasar/Config/Version.h"
@@ -38,8 +37,7 @@ PhasarConfig::PhasarConfig() {
3837
std::string PhasarConfig::readConfigFile(const std::string &Path) {
3938
// We use a local file reading function to make phasar_config independent of
4039
// other phasar libraries.
41-
if (boost::filesystem::exists(Path) &&
42-
!boost::filesystem::is_directory(Path)) {
40+
if (std::filesystem::exists(Path) && !std::filesystem::is_directory(Path)) {
4341
std::ifstream Ifs(Path, std::ios::binary);
4442
if (Ifs.is_open()) {
4543
Ifs.seekg(0, std::ifstream::end);
@@ -58,7 +56,7 @@ void PhasarConfig::loadGlibcSpecialFunctionNames() {
5856
const std::string GLIBCFunctionListFilePath =
5957
ConfigurationDirectory() + GLIBCFunctionListFileName;
6058

61-
if (boost::filesystem::exists(GLIBCFunctionListFilePath)) {
59+
if (std::filesystem::exists(GLIBCFunctionListFilePath)) {
6260
// Load glibc function names specified in the config file
6361
std::vector<std::string> GlibcFunctions;
6462
std::string Glibc = readConfigFile(GLIBCFunctionListFilePath);
@@ -76,7 +74,7 @@ void PhasarConfig::loadGlibcSpecialFunctionNames() {
7674
void PhasarConfig::loadLLVMSpecialFunctionNames() {
7775
const std::string LLVMFunctionListFilePath =
7876
ConfigurationDirectory() + LLVMIntrinsicFunctionListFileName;
79-
if (boost::filesystem::exists(LLVMFunctionListFilePath)) {
77+
if (std::filesystem::exists(LLVMFunctionListFilePath)) {
8078
// Load LLVM function names specified in the config file
8179
std::string LLVMIntrinsics = readConfigFile(LLVMFunctionListFilePath);
8280

@@ -94,7 +92,7 @@ void PhasarConfig::loadLLVMSpecialFunctionNames() {
9492
}
9593

9694
const std::string PhasarConfig::PhasarDir = std::string([]() {
97-
std::string CurrPath = boost::filesystem::current_path().string();
95+
std::string CurrPath = std::filesystem::current_path().string();
9896
size_t I = CurrPath.rfind("build", CurrPath.length());
9997
return CurrPath.substr(0, I);
10098
}());

lib/Config/phasar_config-config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ list(APPEND
44
PHASAR_LLVM_DEPS
55
Support)
66

7-
find_package(Boost COMPONENTS filesystem program_options REQUIRED)
7+
find_package(Boost COMPONENTS program_options REQUIRED)

lib/Controller/AnalysisController.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <iostream>
1414
#include <set>
1515
#include <utility>
16+
#include <filesystem>
1617

1718
#include "llvm/Support/ErrorHandling.h"
1819

@@ -97,7 +98,7 @@ AnalysisController::AnalysisController(
9798
if (!OutDirectory.empty()) {
9899
// create directory for results
99100
ResultDirectory = OutDirectory + "/" + ProjectID + "-" + createTimeStamp();
100-
boost::filesystem::create_directory(ResultDirectory);
101+
std::filesystem::create_directory(ResultDirectory);
101102
}
102103
emitRequestedHelperAnalysisResults();
103104
executeAs(Strategy);

lib/DB/ProjectIRDB.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <algorithm>
1111
#include <cassert>
12+
#include <filesystem>
1213
#include <iostream>
1314
#include <ostream>
1415
#include <string>
@@ -26,8 +27,6 @@
2627
#include "llvm/Support/SourceMgr.h"
2728
#include "llvm/Transforms/Utils.h"
2829

29-
#include "boost/filesystem.hpp"
30-
3130
#include "phasar/Config/Configuration.h"
3231
#include "phasar/DB/ProjectIRDB.h"
3332
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/LLVMZeroValue.h"
@@ -66,7 +65,7 @@ ProjectIRDB::ProjectIRDB(const std::vector<std::string> &IRFiles,
6665

6766
if ((File.find(".ll") != std::string::npos ||
6867
File.find(".bc") != std::string::npos) &&
69-
boost::filesystem::exists(File)) {
68+
std::filesystem::exists(File)) {
7069
llvm::SMDiagnostic Diag;
7170
std::unique_ptr<llvm::LLVMContext> C(new llvm::LLVMContext);
7271
std::unique_ptr<llvm::Module> M = llvm::parseIRFile(File, Diag, *C);

lib/PhasarLLVM/DataFlowSolver/WPDS/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ else()
2222
)
2323
endif()
2424

25-
find_package(Boost COMPONENTS filesystem program_options REQUIRED)
25+
find_package(Boost COMPONENTS program_options REQUIRED)
2626
target_link_libraries(phasar_wpds
2727
LINK_PUBLIC
2828
${Boost_LIBRARIES}

0 commit comments

Comments
 (0)