aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp16
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();