You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In early version of SVF, I have the following code (details trimmed for brevity) to find the memory a pointer points to:
voidcheckFieldRecursively(SVFIR *pag, Andersen *ander, NodeID head)
{
auto currPtrType = SVFUtil::dyn_cast<SVFPointerType>(pag->getGNode(head)->getType());
if (currPtrType->getPtrElementType()->isPointerTy()) {
/* point to objects at the next layer */auto currPts = ander->getPts(head);
for (auto cpit : currPts) {
checkFieldRecursively(pag, ander, cpit);
}
}
}
In this case, I can get set of objects that can be pointed to by a multi-level pointer.
For example, for int **a, it might points to int *aa, *bb. And they might point to int aaa1, aaa2 and int bbb1, bbb2, respectively.
In this case, by recursively checking a PointerType, eventually a non-pointer can be met and then I can get a full set of non-pointer objects that might be pointed to by a pointer at arbitrary level.
However, in #1323, SVFPointerType no longer has method getPtrElementType. This invalidates the code snippet above. I though inferObjType might help, but it deals with raw LLVM types so really confused me.
My question is: How can I get pointer type in absence of getPtrElementType? If not, is there a new interface to achieve the same thing as above, i.e., get all objects (ObjVar) pointed to by a multi-level pointer?
The text was updated successfully, but these errors were encountered:
getPtrElementType is removed because now all pointers are opaque (https://llvm.org/docs/OpaquePointers.html). However, all memory objects are typed. You can always check whether the SVFVar is an object variable and its type.
I think the update in LLVM and SVF makes sense. Since the memory pointed to will always have type info, it's not necessary to keep another copy in the pointer.
Even in the use case above, the users should only be interested in whether an SVFVar is pointer or not: if a node is still pointer, the users should still find its PTS and this process will eventually reach object variable.
Hi,
In early version of SVF, I have the following code (details trimmed for brevity) to find the memory a pointer points to:
In this case, I can get set of objects that can be pointed to by a multi-level pointer.
For example, for
int **a
, it might points toint *aa, *bb
. And they might point toint aaa1, aaa2
andint bbb1, bbb2
, respectively.In this case, by recursively checking a
PointerType
, eventually a non-pointer can be met and then I can get a full set of non-pointer objects that might be pointed to by a pointer at arbitrary level.However, in #1323,
SVFPointerType
no longer has methodgetPtrElementType
. This invalidates the code snippet above. I thoughinferObjType
might help, but it deals with raw LLVM types so really confused me.My question is: How can I get pointer type in absence of
getPtrElementType
? If not, is there a new interface to achieve the same thing as above, i.e., get all objects (ObjVar
) pointed to by a multi-level pointer?The text was updated successfully, but these errors were encountered: