Remove this file; the code that it went with is no longer
[oota-llvm.git] / lib / Debugger / ProgramInfo.cpp
index 66d38f73ca853c6bd816a76012dd969063528882..408704dad168443311b46fcbea7fc0a2e650cf57 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -14,6 +14,7 @@
 
 #include "llvm/Debugger/ProgramInfo.h"
 #include "llvm/Constants.h"
+#include "llvm/Analysis/ValueTracking.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicInst.h"
@@ -23,8 +24,6 @@
 #include "llvm/Debugger/SourceLanguage.h"
 #include "llvm/Support/SlowOperationInformer.h"
 #include "llvm/ADT/STLExtras.h"
-#include <iostream>
-
 using namespace llvm;
 
 /// getGlobalVariablesUsing - Return all of the global variables which have the
@@ -61,7 +60,7 @@ static const GlobalVariable *getNextStopPoint(const Value *V, unsigned &LineNo,
       
       // If we found a stop point, check to see if it is earlier than what we
       // already have.  If so, remember it.
-      if (const Function *F = CI->getCalledFunction())
+      if (CI->getCalledFunction())
         if (const DbgStopPointInst *SPI = dyn_cast<DbgStopPointInst>(CI)) {
           unsigned CurLineNo = SPI->getLine();
           unsigned CurColNo = SPI->getColumn();
@@ -114,11 +113,13 @@ SourceFileInfo::SourceFileInfo(const GlobalVariable *Desc,
   if (Desc && Desc->hasInitializer())
     if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Desc->getInitializer()))
       if (CS->getNumOperands() > 4) {
-        if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(CS->getOperand(1)))
-          Version = CUI->getValue();
+        if (ConstantInt *CUI = dyn_cast<ConstantInt>(CS->getOperand(1)))
+          Version = CUI->getZExtValue();
 
-        BaseName  = CS->getOperand(3)->getStringValue();
-        Directory = CS->getOperand(4)->getStringValue();
+        if (!GetConstantStringInfo(CS->getOperand(3), BaseName))
+          BaseName = "";
+        if (!GetConstantStringInfo(CS->getOperand(4), Directory))
+          Directory = "";
       }
 }
 
@@ -158,7 +159,8 @@ SourceFunctionInfo::SourceFunctionInfo(ProgramInfo &PI,
           SourceFile = &PI.getSourceFile(GV);
 
         // Entry #2 is the function name.
-        Name = CS->getOperand(2)->getStringValue();
+        if (!GetConstantStringInfo(CS->getOperand(2), Name))
+          Name = "";
       }
 }
 
@@ -181,8 +183,8 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo,
             if (SD) {             // We found the first stop point!
               // This is just a sanity check.
               if (getSourceFile().getDescriptor() != SD)
-                std::cout << "WARNING: first line of function is not in the"
-                  " file that the function descriptor claims it is in.\n";
+                cout << "WARNING: first line of function is not in the"
+                     << " file that the function descriptor claims it is in.\n";
               break;
             }
           }
@@ -196,8 +198,10 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo,
 
 ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
   assert(M && "Cannot create program information with a null module!");
-  sys::Path modulePath(M->getModuleIdentifier());
-  ProgramTimeStamp = modulePath.getTimestamp();
+  sys::PathWithStatus ModPath(M->getModuleIdentifier());
+  const sys::FileStatus *Stat = ModPath.getFileStatus();
+  if (Stat)
+    ProgramTimeStamp = Stat->getTimestamp();
 
   SourceFilesIsComplete = false;
   SourceFunctionsIsComplete = false;
@@ -236,8 +240,8 @@ ProgramInfo::getSourceFile(const GlobalVariable *Desc) {
   if (Desc && Desc->hasInitializer())
     if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Desc->getInitializer()))
       if (CS->getNumOperands() > 2)
-        if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(CS->getOperand(2)))
-          LangID = CUI->getValue();
+        if (ConstantInt *CUI = dyn_cast<ConstantInt>(CS->getOperand(2)))
+          LangID = CUI->getZExtValue();
 
   const SourceLanguage &Lang = SourceLanguage::get(LangID);
   SourceFileInfo *New = Lang.createSourceFileInfo(Desc, *this);