about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-06-23 18:17:03 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-06-23 18:17:03 +0000
commit384a6c5652ae815f33e2a6cd1013b1cf14caed63 (patch)
tree96177325c9d9204b20c55e18b977b893340d126f /lib
parente6d22bdfa029067ab9c48889167df5f1af05c982 (diff)
downloadklee-384a6c5652ae815f33e2a6cd1013b1cf14caed63.tar.gz
When extracting path from debug info, use file name on its own if it begins with '/'
Clang has been observed to use an absolute path in the 'filename'
field.

git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@133740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Module/InstructionInfoTable.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp
index 390451f5..e08dc2b3 100644
--- a/lib/Module/InstructionInfoTable.cpp
+++ b/lib/Module/InstructionInfoTable.cpp
@@ -81,19 +81,12 @@ static std::string getDSPIPath(const DbgStopPointInst *dspi) {
   assert(res && "GetConstantStringInfo failed");
   res = GetConstantStringInfo(dspi->getFileName(), file);
   assert(res && "GetConstantStringInfo failed");
-  if (dir.empty()) {
-    return file;
-  } else if (*dir.rbegin() == '/') {
-    return dir + file;
-  } else {
-    return dir + "/" + file;
-  }
-}
 #else
 static std::string getDSPIPath(DILocation Loc) {
   std::string dir = Loc.getDirectory();
   std::string file = Loc.getFilename();
-  if (dir.empty()) {
+#endif
+  if (dir.empty() || file[0] == '/') {
     return file;
   } else if (*dir.rbegin() == '/') {
     return dir + file;
@@ -101,7 +94,6 @@ static std::string getDSPIPath(DILocation Loc) {
     return dir + "/" + file;
   }
 }
-#endif
 
 bool InstructionInfoTable::getInstructionDebugInfo(const llvm::Instruction *I, 
                                                    const std::string *&File,