diff --git a/include/phasar/ControlFlow/CallGraph.h b/include/phasar/ControlFlow/CallGraph.h index 7751aa963..d73a1b578 100644 --- a/include/phasar/ControlFlow/CallGraph.h +++ b/include/phasar/ControlFlow/CallGraph.h @@ -296,7 +296,7 @@ CallGraph::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); diff --git a/include/phasar/ControlFlow/CallGraphData.h b/include/phasar/ControlFlow/CallGraphData.h index 4321d7cea..ed50d66e4 100644 --- a/include/phasar/ControlFlow/CallGraphData.h +++ b/include/phasar/ControlFlow/CallGraphData.h @@ -19,7 +19,8 @@ namespace psr { struct CallGraphData { - std::unordered_map> FToFunctionVertexTy{}; + // Mangled FunName --> [CS-IDs] + std::unordered_map> FToFunctionVertexTy{}; CallGraphData() noexcept = default; void printAsJson(llvm::raw_ostream &OS); diff --git a/lib/ControlFlow/CallGraphData.cpp b/lib/ControlFlow/CallGraphData.cpp index 8b0f13a85..5b4e254f6 100644 --- a/lib/ControlFlow/CallGraphData.cpp +++ b/lib/ControlFlow/CallGraphData.cpp @@ -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 { @@ -20,10 +21,11 @@ static CallGraphData getDataFromJson(const nlohmann::json &Json) { for (const auto &[FVal, FunctionVertexTyVals] : Json.get()) { auto &FValMappedVector = ToReturn.FToFunctionVertexTy[FVal]; - FValMappedVector.reserve(FunctionVertexTyVals.size()); - - for (const auto &Curr : FunctionVertexTyVals) { - FValMappedVector.push_back(Curr.get()); + if (FunctionVertexTyVals.is_array()) { + FValMappedVector = FunctionVertexTyVals.get>(); + } else if (!FunctionVertexTyVals.is_null()) { + PHASAR_LOG_LEVEL( + WARNING, "Invalid Function-CS IDs Array: " << FunctionVertexTyVals); } } diff --git a/lib/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchy.cpp b/lib/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchy.cpp index ce8f8ab27..be0f02c07 100644 --- a/lib/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchy.cpp +++ b/lib/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchy.cpp @@ -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) { @@ -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)); @@ -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));