Skip to content
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

opaque pointer stage 2-1 #1304

Merged
merged 1 commit into from
Jan 4, 2024
Merged

opaque pointer stage 2-1 #1304

merged 1 commit into from
Jan 4, 2024

Conversation

jumormt
Copy link
Contributor

@jumormt jumormt commented Dec 28, 2023

infer object type based on instructions or globals

}
else
{
assert(false && (LLVMUtil::dumpValue(value) + "Unknown llvm Type, cannot get Ptr Element Type").c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to dump this unknown value.

{
// collect object type in instructions (alloc, heap) and globals
if (LLVMUtil::isObject(val)) {
const Type *objtype = LLVMUtil::getPointeeType(val);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would void* x = malloc() work here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object type has to be inferred here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object type has to be inferred here?

I agree. For malloc site, this should be done after inferring malloc type. For other types, it is ok to collect here.

Copy link

codecov bot commented Dec 28, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (b8c148c) 64.61% compared to head (d6b5c61) 64.64%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1304      +/-   ##
==========================================
+ Coverage   64.61%   64.64%   +0.02%     
==========================================
  Files         225      225              
  Lines       23892    23875      -17     
==========================================
- Hits        15438    15434       -4     
+ Misses       8454     8441      -13     
Files Coverage Δ
svf-llvm/include/SVF-LLVM/LLVMUtil.h 74.19% <ø> (ø)
svf-llvm/lib/LLVMUtil.cpp 77.69% <ø> (+1.93%) ⬆️
svf-llvm/lib/SVFIRBuilder.cpp 78.37% <100.00%> (ø)
svf-llvm/lib/SymbolTableBuilder.cpp 86.47% <80.00%> (-0.44%) ⬇️

@@ -590,8 +592,8 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value* val)
// (2) Other objects (e.g., alloca, global, etc.)
else
{
if(const PointerType* refTy = SVFUtil::dyn_cast<PointerType>(val->getType()))
objTy = getPtrElementType(refTy);
if(SVFUtil::isa<PointerType>(val->getType()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that this pointee type has to be inferred if this val is an object from a malloc site.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that this pointee type has to be inferred if this val is an object from a malloc site.

This branch cannot be a malloc site. The object is alloca, global, etc. The malloc site is not yet done (to be done in inferTypeOfHeapObjOrStaticObj).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

@@ -598,6 +590,8 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value* val)

if (objTy)
{
// collect object type information
(void) getOrAddSVFTypeInfo(objTy);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return an SVFType ad use it at line 596.

@jumormt jumormt force-pushed the opaque branch 3 times, most recently from c889648 to eb941d8 Compare January 3, 2024 00:44
@jumormt jumormt marked this pull request as draft January 3, 2024 09:45
@jumormt jumormt marked this pull request as ready for review January 3, 2024 10:32
@jumormt
Copy link
Contributor Author

jumormt commented Jan 4, 2024

@yuleisui yuleisui merged commit fbdedbe into SVF-tools:master Jan 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants