Skip to content

Commit 659cb8d

Browse files
MMoryMartin Moryfabianbs96
authored
Fix global handling in type state analysis (#651)
* 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 <linuxfan91@googlemail.com> Co-authored-by: Fabian Schiebel <fabian.schiebel@iem.fraunhofer.de>
1 parent 5ddab3f commit 659cb8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,16 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
182182
n_t CallSite, n_t /*RetSite*/, llvm::ArrayRef<f_t> Callees)
183183
-> FlowFunctionPtrType {
184184
const auto *CS = llvm::cast<llvm::CallBase>(CallSite);
185+
bool DeclarationOnlyCalleeFound = false;
185186
for (const auto *Callee : Callees) {
186187
std::string DemangledFname = llvm::demangle(Callee->getName().str());
187188
// Generate the return value of factory functions from zero value
188189
if (isFactoryFunction(DemangledFname)) {
189190
return this->generateFromZero(CS);
190191
}
191192

193+
DeclarationOnlyCalleeFound |= Callee->isDeclaration();
194+
192195
/// XXX: Revisit this:
193196

194197
// Handle all functions that are not modeld with special semantics.
@@ -209,6 +212,10 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
209212
}
210213
}
211214
}
215+
if (!DeclarationOnlyCalleeFound) {
216+
return killFlowIf(
217+
[](d_t Source) { return llvm::isa<llvm::Constant>(Source); });
218+
}
212219
return identityFlow();
213220
}
214221

0 commit comments

Comments
 (0)