Skip to content

Commit e3839b8

Browse files
Martin MoryMMory
authored andcommitted
Merge branch 'development' into f-RemovePlugins
2 parents 77db347 + df77c7c commit e3839b8

253 files changed

Lines changed: 2450 additions & 3392 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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 graph program_options log ${BOOST_THREAD} REQUIRED)
129-
#find_package(Boost 1.72.0 COMPONENTS graph program_options log ${BOOST_THREAD} REQUIRED)
128+
find_package(Boost 1.65.1 COMPONENTS graph program_options ${BOOST_THREAD} REQUIRED)
129+
#find_package(Boost 1.72.0 COMPONENTS graph program_options ${BOOST_THREAD} REQUIRED)
130130
include_directories(${Boost_INCLUDE_DIRS})
131131

132132
# Disable clang-tidy for the external projects
@@ -407,7 +407,6 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MIN
407407
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
408408
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost_program_options (>= 1.66.0),
409409
# libboost_graph (>= 1.66.0),
410-
# libboost_log (>= 1.66.0),
411410
# libboost_thread (>= 1.66.0),
412411
# libsqlite3 (>= 4.5.0),
413412
# libpthread (>= 4.5.0),

bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ else
100100
# install missing packages if necessary
101101
boostlibnames=("libboost-system" "libboost-filesystem"
102102
"libboost-graph" "libboost-program-options"
103-
"libboost-log" "libboost-thread")
103+
"libboost-thread")
104104
additional_boost_libs=()
105105
for boost_lib in ${boostlibnames[@]}; do
106106
dpkg -s "$boost_lib${DESIRED_BOOST_VERSION}" >/dev/null 2>&1 ||

cmake/phasar_macros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function(generate_ll_file)
7676
set(test_code_file_target "${parent_dir}_${test_code_file_name}${ll_file_suffix}")
7777

7878
# define compilation flags
79-
set(GEN_CXX_FLAGS -std=c++14 -fno-discard-value-names -emit-llvm -S)
79+
set(GEN_CXX_FLAGS -std=c++17 -fno-discard-value-names -emit-llvm -S)
8080
set(GEN_C_FLAGS -fno-discard-value-names -emit-llvm -S)
8181
set(GEN_CMD_COMMENT "[LL]")
8282
if(GEN_LL_MEM2REG)

examples/llvm-hello-world/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <iostream>
21
#include <memory>
32
#include <string>
43

@@ -20,7 +19,7 @@
2019

2120
int main(int argc, char **argv) {
2221
if (argc != 2) {
23-
std::cout << "usage: <prog> <IR file>\n";
22+
llvm::errs() << "usage: <prog> <IR file>\n";
2423
return 1;
2524
}
2625
// parse an IR file into an LLVM module

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

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

1010
#include <filesystem>
1111
#include <fstream>
12-
#include <iostream>
1312

1413
#include "phasar/DB/ProjectIRDB.h"
1514
#include "phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h"
@@ -31,12 +30,11 @@ using namespace psr;
3130
int main(int argc, const char **argv) {
3231
if (argc < 2 || !std::filesystem::exists(argv[1]) ||
3332
std::filesystem::is_directory(argv[1])) {
34-
std::cerr << "myphasartool\n"
35-
"A small PhASAR-based example program\n\n"
36-
"Usage: myphasartool <LLVM IR file>\n";
33+
llvm::errs() << "myphasartool\n"
34+
"A small PhASAR-based example program\n\n"
35+
"Usage: myphasartool <LLVM IR file>\n";
3736
return 1;
3837
}
39-
initializeLogger(false);
4038
ProjectIRDB DB({argv[1]});
4139
if (auto F = DB.getFunctionDefinition("main")) {
4240
LLVMTypeHierarchy H(DB);
@@ -49,21 +47,21 @@ int main(int argc, const char **argv) {
4947
// print inter-procedural control-flow graph
5048
I.print();
5149
// IFDS template parametrization test
52-
std::cout << "Testing IFDS:\n";
50+
llvm::outs() << "Testing IFDS:\n";
5351
IFDSLinearConstantAnalysis L(&DB, &H, &I, &P, {"main"});
5452
IFDSSolver_P<IFDSLinearConstantAnalysis> S(L);
5553
S.solve();
5654
S.dumpResults();
5755
// use PhASAR's strategy concept that allows for even easier analysis set-up
58-
std::cout << "Testing IDE:\n";
56+
llvm::outs() << "Testing IDE:\n";
5957
WholeProgramAnalysis<IDESolver_P<IDELinearConstantAnalysis>,
6058
IDELinearConstantAnalysis>
6159
WPA(DB, {"main"}, &P, &I, &H);
6260
WPA.solve();
6361
WPA.dumpResults();
6462
WPA.releaseAllHelperAnalyses();
6563
} else {
66-
std::cerr << "error: file does not contain a 'main' function!\n";
64+
llvm::errs() << "error: file does not contain a 'main' function!\n";
6765
}
6866
return 0;
6967
}

include/phasar/Controller/AnalysisController.h

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#ifndef PHASAR_CONTROLLER_ANALYSISCONTROLLER_H
1111
#define PHASAR_CONTROLLER_ANALYSISCONTROLLER_H
1212

13-
#include <iostream>
1413
#include <set>
1514
#include <string>
1615
#include <vector>
@@ -149,34 +148,41 @@ class AnalysisController {
149148
}
150149
}
151150

151+
std::unique_ptr<llvm::raw_fd_ostream>
152+
openFileStream(llvm::StringRef Filename);
153+
152154
template <typename T> void emitRequestedDataFlowResults(T &WPA) {
153155
if (EmitterOptions & AnalysisControllerEmitterOptions::EmitTextReport) {
154156
if (!ResultDirectory.empty()) {
155-
std::ofstream OFS(ResultDirectory.string() + "/psr-report.txt");
156-
WPA.emitTextReport(OFS);
157+
if (auto OFS = openFileStream("/psr-report.txt")) {
158+
WPA.emitTextReport(*OFS);
159+
}
157160
} else {
158-
WPA.emitTextReport(std::cout);
161+
WPA.emitTextReport(llvm::outs());
159162
}
160163
}
161164
if (EmitterOptions &
162165
AnalysisControllerEmitterOptions::EmitGraphicalReport) {
163166
if (!ResultDirectory.empty()) {
164-
std::ofstream OFS(ResultDirectory.string() + "/psr-report.html");
165-
WPA.emitGraphicalReport(OFS);
167+
if (auto OFS = openFileStream("/psr-report.html")) {
168+
WPA.emitGraphicalReport(*OFS);
169+
}
166170
} else {
167-
WPA.emitGraphicalReport(std::cout);
171+
WPA.emitGraphicalReport(llvm::outs());
168172
}
169173
}
170174
if (EmitterOptions & AnalysisControllerEmitterOptions::EmitRawResults) {
171175
if (!ResultDirectory.empty()) {
172-
std::ofstream OFS(ResultDirectory.string() + "/psr-raw-results.txt");
173-
WPA.dumpResults(OFS);
176+
if (auto OFS = openFileStream("/psr-raw-results.txt")) {
177+
WPA.dumpResults(*OFS);
178+
}
174179
} else {
175-
WPA.dumpResults(std::cout);
180+
WPA.dumpResults(llvm::outs());
176181
}
177182
}
178183
if (EmitterOptions & AnalysisControllerEmitterOptions::EmitESGAsDot) {
179-
std::cout << "Front-end support for 'EmitESGAsDot' to be implemented\n";
184+
llvm::outs()
185+
<< "Front-end support for 'EmitESGAsDot' to be implemented\n";
180186
}
181187
}
182188

include/phasar/DB/DBConn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define PHASAR_DB_DBCONN_H_
1919
2020
#include <initializer_list>
21-
#include <iostream> // Because of SQL_STD_ERROR_HANDLING
2221
#include <memory>
2322
#include <set>
2423
#include <string>

include/phasar/DB/Hexastore.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#define PHASAR_DB_HEXASTORE_H_
1212

1313
#include <array>
14-
#include <iosfwd>
1514
#include <string>
1615
#include <vector>
1716

17+
#include "llvm/Support/raw_ostream.h"
18+
1819
#include "boost/format.hpp"
1920

2021
#include "sqlite3.h"
@@ -39,7 +40,8 @@ struct HSResult {
3940
: Subject(Subject), Predicate(std::move(Predicate)),
4041
Object(std::move(Object)) {}
4142
/// Prints an entry of the results to the command-line
42-
friend std::ostream &operator<<(std::ostream &OS, const HSResult &Result) {
43+
friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
44+
const HSResult &Result) {
4345
return OS << "[ subject: " << Result.Subject
4446
<< " | predicate: " << Result.Predicate
4547
<< " | object: " << Result.Object << " ]";

include/phasar/DB/ProjectIRDB.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#ifndef PHASAR_DB_PROJECTIRDB_H_
1111
#define PHASAR_DB_PROJECTIRDB_H_
1212

13-
#include <iostream>
1413
#include <map>
1514
#include <memory>
1615
#include <set>
@@ -180,7 +179,7 @@ class ProjectIRDB {
180179

181180
void print() const;
182181

183-
void emitPreprocessedIR(std::ostream &OS = std::cout,
182+
void emitPreprocessedIR(llvm::raw_ostream &OS = llvm::outs(),
184183
bool ShortenIR = false) const;
185184

186185
/**

include/phasar/PhasarClang/MyMatcher.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)