Skip to content

Commit

Permalink
add param types in svffuntype (#1673)
Browse files Browse the repository at this point in the history
* add param types in svffuntype

* add param types in svffuntype
  • Loading branch information
jumormt authored Mar 3, 2025
1 parent fa081a8 commit a3b6a23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions svf-llvm/lib/LLVMModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,13 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
svfIntT->setSignAndWidth(intT->getSignBit() ? -signWidth : signWidth);
svftype = svfIntT;
}
else if (const FunctionType* ft = SVFUtil::dyn_cast<FunctionType>(T))
svftype = new SVFFunctionType(getSVFType(ft->getReturnType()));
else if (const FunctionType* ft = SVFUtil::dyn_cast<FunctionType>(T)) {
std::vector<const SVFType*> paramTypes;
for (const auto& t: ft->params()) {
paramTypes.push_back(getSVFType(t));
}
svftype = new SVFFunctionType(getSVFType(ft->getReturnType()), paramTypes);
}
else if (const StructType* st = SVFUtil::dyn_cast<StructType>(T))
{
auto svfst = new SVFStructType(byteSize);
Expand Down
10 changes: 8 additions & 2 deletions svf/include/SVFIR/SVFType.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,14 @@ class SVFFunctionType : public SVFType

private:
const SVFType* retTy;
std::vector<const SVFType*> params;

public:
SVFFunctionType(const SVFType* rt)
: SVFType(false, SVFFunctionTy, 1), retTy(rt)
SVFFunctionType(const SVFType* rt, const std::vector<const SVFType*>& p)
: SVFType(false, SVFFunctionTy, 1), retTy(rt), params(p)
{
}

static inline bool classof(const SVFType* node)
{
return node->getKind() == SVFFunctionTy;
Expand All @@ -338,6 +340,10 @@ class SVFFunctionType : public SVFType
return retTy;
}

const std::vector<const SVFType*>& getParamTypes() const {
return params;
}

void print(std::ostream& os) const override;
};

Expand Down

0 comments on commit a3b6a23

Please sign in to comment.