[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Tue Jun 27 18:16:18 PDT 2006



Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.151 -> 1.152
---
Log message:

add some missing externals

---
Diffs of the changes:  (+18 -3)

 Local.cpp |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.151 llvm/lib/Analysis/DataStructure/Local.cpp:1.152
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.151	Tue Apr 25 14:33:23 2006
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Tue Jun 27 20:16:06 2006
@@ -591,6 +591,8 @@
           }
         }
 
+	//gets select localtime ioctl
+
         if ((F->isExternal() && F->getName() == "calloc") 
             || F->getName() == "posix_memalign"
             || F->getName() == "memalign" || F->getName() == "valloc") {
@@ -627,7 +629,8 @@
                    F->getName() == "puts" || F->getName() == "write" ||
                    F->getName() == "open" || F->getName() == "create" ||
                    F->getName() == "truncate" || F->getName() == "chdir" ||
-                   F->getName() == "mkdir" || F->getName() == "rmdir") {
+                   F->getName() == "mkdir" || F->getName() == "rmdir" ||
+		   F->getName() == "strlen") {
           // These functions read all of their pointer operands.
           for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end();
                AI != E; ++AI) {
@@ -636,7 +639,7 @@
                 N->setReadMarker();
           }
           return;
-        } else if (F->getName() == "memchr") {
+	} else if (F->getName() == "memchr") {
           DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
           DSNodeHandle Result = getValueDest(*CS.getInstruction());
           RetNH.mergeWith(Result);
@@ -644,7 +647,8 @@
             N->setReadMarker();
           return;
         } else if (F->getName() == "read" || F->getName() == "pipe" ||
-                   F->getName() == "wait" || F->getName() == "time") {
+                   F->getName() == "wait" || F->getName() == "time" ||
+		   F->getName() == "getrusage") {
           // These functions write all of their pointer operands.
           for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end();
                AI != E; ++AI) {
@@ -1002,6 +1006,17 @@
           if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode())
             N->setReadMarker();
           return;
+        } else if (F->getName() == "strcpy" || F->getName() == "strncpy") {
+          //This might be making unsafe assumptions about usage
+          //Merge return and first arg
+          DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
+          RetNH.mergeWith(getValueDest(**CS.arg_begin()));
+          if (DSNode *N = RetNH.getNode())
+            N->setHeapNodeMarker()->setModifiedMarker();
+          //and read second pointer
+          if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode())
+            N->setReadMarker();
+          return;
         } else {
           // Unknown function, warn if it returns a pointer type or takes a
           // pointer argument.






More information about the llvm-commits mailing list