Make the LegalizeType method naming scheme more regular.
[oota-llvm.git] / lib / Debugger / ProgramInfo.cpp
index d811f6075be2fbc902fc622778cc757cf6d6055d..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"
@@ -115,8 +116,10 @@ SourceFileInfo::SourceFileInfo(const GlobalVariable *Desc,
         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 = "";
       }
 }
 
@@ -156,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 = "";
       }
 }
 
@@ -194,8 +198,8 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo,
 
 ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
   assert(M && "Cannot create program information with a null module!");
-  const sys::FileStatus *Stat;
-  Stat = sys::Path(M->getModuleIdentifier()).getFileStatus();
+  sys::PathWithStatus ModPath(M->getModuleIdentifier());
+  const sys::FileStatus *Stat = ModPath.getFileStatus();
   if (Stat)
     ProgramTimeStamp = Stat->getTimestamp();