diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-20 16:50:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-20 16:50:46 +0000 |
commit | 894263bc9f9276ed62b16ede5baecafe2f61840a (patch) | |
tree | ad0e8d6247ba1310cf8bf4ac9873f1b86f70b53c /lib/Analysis/DataStructure/Local.cpp | |
parent | 808a7aeec77e79ad236614a578b1bb758ce796ab (diff) |
Add special case handling for calloc and realloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 1b082833de..43edb18433 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -412,6 +412,22 @@ void GraphBuilder::visitInvokeInst(InvokeInst &II) { } void GraphBuilder::visitCallSite(CallSite CS) { + // Special case handling of certain libc allocation functions here. + if (Function *F = CS.getCalledFunction()) + if (F->isExternal()) + if (F->getName() == "calloc") { + setDestTo(*CS.getInstruction(), + createNode()->setHeapNodeMarker()->setModifiedMarker()); + return; + } else if (F->getName() == "realloc") { + DSNodeHandle RetNH = getValueDest(*CS.getInstruction()); + RetNH.mergeWith(getValueDest(**CS.arg_begin())); + DSNode *N = RetNH.getNode(); + if (N) N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker(); + return; + } + + // Set up the return value... DSNodeHandle RetVal; Instruction *I = CS.getInstruction(); |