Skip to content

Commit

Permalink
Fix global handling in type state analysis (#651)
Browse files Browse the repository at this point in the history
* fix global handling in type state analysis

* Fix error due to update from dev

* fix killing of globals: only kill if no declaration-only func is called

---------

Co-authored-by: Martin Mory <[email protected]>
Co-authored-by: Fabian Schiebel <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2023
1 parent 5ddab3f commit 659cb8d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
n_t CallSite, n_t /*RetSite*/, llvm::ArrayRef<f_t> Callees)
-> FlowFunctionPtrType {
const auto *CS = llvm::cast<llvm::CallBase>(CallSite);
bool DeclarationOnlyCalleeFound = false;
for (const auto *Callee : Callees) {
std::string DemangledFname = llvm::demangle(Callee->getName().str());
// Generate the return value of factory functions from zero value
if (isFactoryFunction(DemangledFname)) {
return this->generateFromZero(CS);
}

DeclarationOnlyCalleeFound |= Callee->isDeclaration();

/// XXX: Revisit this:

// Handle all functions that are not modeld with special semantics.
Expand All @@ -209,6 +212,10 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
}
}
}
if (!DeclarationOnlyCalleeFound) {
return killFlowIf(
[](d_t Source) { return llvm::isa<llvm::Constant>(Source); });
}
return identityFlow();
}

Expand Down

0 comments on commit 659cb8d

Please sign in to comment.