8000 fix allocate type id by jumormt · Pull Request #1729 · SVF-tools/SVF · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix allocate type id #1729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion svf-llvm/lib/LLVMModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)

SVFType* svftype;

u32_t id = svfir->getSVFTypes().size();
u32_t id = NodeIDAllocator::get()->allocateTypeId();
if (SVFUtil::isa<PointerType>(T))
{
svftype = new SVFPointerType(id, byteSize);
Expand Down
5 changes: 5 additions & 0 deletions svf/include/Util/NodeIDAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class NodeIDAllocator
/// Allocate an object ID as determined by the strategy.
NodeID allocateObjectId(void);

/// Allocate an type ID as determined by the strategy.
NodeID allocateTypeId(void);

/// Allocate a GEP object ID as determined by the strategy.
/// allocateObjectId is still fine for GEP objects, but
/// for some strategies (DBUG, namely), GEP objects can
Expand Down Expand Up @@ -103,6 +106,8 @@ class NodeIDAllocator
NodeID numSymbols;
/// Total number of objects and values allocated.
NodeID numNodes;
/// Total number of svftypes
NodeID numType;
///@}

/// Strategy to allocate with.
Expand Down
7 changes: 6 additions & 1 deletion svf/lib/Util/NodeIDAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void NodeIDAllocator::unset(void)

// Initialise counts to 4 because that's how many special nodes we have.
NodeIDAllocator::NodeIDAllocator(void)
: numObjects(4), numValues(4), numSymbols(4), numNodes(4), strategy(Options::NodeAllocStrat())
: numObjects(4), numValues(4), numSymbols(4), numNodes(4), numType(0), strategy(Options::NodeAllocStrat())
{ }

NodeID NodeIDAllocator::allocateObjectId(void)
Expand Down Expand Up @@ -83,6 +83,11 @@ NodeID NodeIDAllocator::allocateObjectId(void)
return id;
}


NodeID NodeIDAllocator::allocateTypeId() {
return numType++;
}

NodeID NodeIDAllocator::allocateGepObjectId(NodeID base, u32_t offset, u32_t maxFieldLimit)
{
NodeID id = 0;
Expand Down
Loading
0