Skip to content

Commit

Permalink
Changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs96 committed Oct 22, 2024
1 parent 3c4b8b2 commit c1e28fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/phasar/ControlFlow/CallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ CallGraph<N, F>::deserialize(const CallGraphData &PrecomputedCG,
const auto &CS = std::invoke(GetInstructionFromId, JId);
if (!CS) {
PHASAR_LOG_LEVEL_CAT(WARNING, "CallGraph",
"Invalid CAll-Instruction Id: " << JId);
"Invalid Call-Instruction Id: " << JId);
}

CGBuilder.addCallEdge(CS, Fun);
Expand Down
3 changes: 2 additions & 1 deletion include/phasar/ControlFlow/CallGraphData.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

namespace psr {
struct CallGraphData {
std::unordered_map<std::string, std::vector<int>> FToFunctionVertexTy{};
// Mangled FunName --> [CS-IDs]
std::unordered_map<std::string, std::vector<uint32_t>> FToFunctionVertexTy{};

CallGraphData() noexcept = default;
void printAsJson(llvm::raw_ostream &OS);
Expand Down
10 changes: 6 additions & 4 deletions lib/ControlFlow/CallGraphData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "phasar/ControlFlow/CallGraphData.h"

#include "phasar/Utils/IO.h"
#include "phasar/Utils/Logger.h"
#include "phasar/Utils/NlohmannLogging.h"

namespace psr {
Expand All @@ -20,10 +21,11 @@ static CallGraphData getDataFromJson(const nlohmann::json &Json) {
for (const auto &[FVal, FunctionVertexTyVals] :
Json.get<nlohmann::json::object_t>()) {
auto &FValMappedVector = ToReturn.FToFunctionVertexTy[FVal];
FValMappedVector.reserve(FunctionVertexTyVals.size());

for (const auto &Curr : FunctionVertexTyVals) {
FValMappedVector.push_back(Curr.get<int>());
if (FunctionVertexTyVals.is_array()) {
FValMappedVector = FunctionVertexTyVals.get<std::vector<uint32_t>>();
} else if (!FunctionVertexTyVals.is_null()) {
PHASAR_LOG_LEVEL(
WARNING, "Invalid Function-CS IDs Array: " << FunctionVertexTyVals);
}
}

Expand Down
7 changes: 2 additions & 5 deletions lib/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ static const llvm::DIType *stringToDIType(const llvm::DebugInfoFinder &DIF,
llvm::report_fatal_error("DIType doesn't exist " + DITypeName);
}

// NOLINTNEXTLINE
static constexpr char NullFunName[] = "__null__";

DIBasedTypeHierarchy::DIBasedTypeHierarchy(
const LLVMProjectIRDB *IRDB, const DIBasedTypeHierarchyData &SerializedData)
: TransitiveDerivedIndex(SerializedData.TransitiveDerivedIndex) {
Expand Down Expand Up @@ -287,7 +284,7 @@ DIBasedTypeHierarchy::DIBasedTypeHierarchy(

CurrVTable.reserve(Curr.size());
for (const auto &FuncName : Curr) {
if (FuncName == NullFunName) {
if (FuncName == LLVMVFTable::NullFunName) {
CurrVTable.push_back(nullptr);
}
CurrVTable.push_back(IRDB->getFunction(FuncName));
Expand Down Expand Up @@ -375,7 +372,7 @@ DIBasedTypeHierarchyData DIBasedTypeHierarchy::getTypeHierarchyData() const {
CurrVTableAsString.push_back(Func->getName().str());
continue;
}
CurrVTableAsString.emplace_back(NullFunName);
CurrVTableAsString.emplace_back(LLVMVFTable::NullFunName);
}

Data.VTables.push_back(std::move(CurrVTableAsString));
Expand Down

0 comments on commit c1e28fb

Please sign in to comment.