From 384a6c5652ae815f33e2a6cd1013b1cf14caed63 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 23 Jun 2011 18:17:03 +0000 Subject: 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 --- lib/Module/InstructionInfoTable.cpp | 12 ++---------- 1 file 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, -- cgit 1.4.1