Index: llvm/tools/sanstats/sanstats.cpp =================================================================== --- llvm/tools/sanstats/sanstats.cpp +++ llvm/tools/sanstats/sanstats.cpp @@ -15,7 +15,9 @@ #include "llvm/DebugInfo/Symbolize/Symbolize.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Path.h" #include "llvm/Transforms/Utils/SanitizerStats.h" #include @@ -52,7 +54,11 @@ ++Begin; if (Begin == End) return nullptr; - StringRef Filename(FilenameBegin, Begin - FilenameBegin); + std::string Filename(FilenameBegin, Begin - FilenameBegin); + + if (!llvm::sys::fs::exists(Filename)) + Filename = std::string(llvm::sys::path::parent_path(ClInputFile)) + + std::string(llvm::sys::path::filename(Filename)); ++Begin; if (Begin == End)