Skip to content

Commit bb292c3

Browse files
committed
Fixes linking issue, where PTS requires getNumGlobals
We need to move getNumGlobals into the ProjectIRDB header because the current implementation of the PointsToSet constructor uses it, however, phasar_db(ProjectIRDB) links against phasar_pointer, so we cannot link PointsToSet against phasar_db. By defining the function in the header we cirmumvent this issue, however, we should be careful to not introduce cyclic dependencies in the future.
1 parent ed67292 commit bb292c3

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

include/phasar/DB/ProjectIRDB.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,13 @@ class ProjectIRDB {
172172
return IDInstructionMapping.size();
173173
}
174174

175-
[[nodiscard]] std::size_t getNumGlobals() const;
175+
[[nodiscard]] std::size_t getNumGlobals() const {
176+
std::size_t Ret = 0;
177+
for (const auto &[File, Module] : Modules) {
178+
Ret += Module->global_size();
179+
}
180+
return Ret;
181+
}
176182

177183
[[nodiscard]] llvm::Instruction *getInstruction(std::size_t Id);
178184

lib/DB/ProjectIRDB.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,6 @@ llvm::Module *ProjectIRDB::getModule(const std::string &ModuleName) {
237237
return nullptr;
238238
}
239239

240-
std::size_t ProjectIRDB::getNumGlobals() const {
241-
std::size_t Ret = 0;
242-
for (const auto &[File, Module] : Modules) {
243-
Ret += Module->global_size();
244-
}
245-
return Ret;
246-
}
247-
248240
llvm::Instruction *ProjectIRDB::getInstruction(std::size_t Id) {
249241
if (IDInstructionMapping.count(Id)) {
250242
return IDInstructionMapping[Id];

0 commit comments

Comments
 (0)