diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h index e98ab29ec305..b5ed2c7d5097 100644 --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -353,7 +353,7 @@ public: /// Return the full path to the file. std::string getAbsolutePath() const; /// Return the file name relative to the compilation directory. - StringRef getRelativePath() const { return File->getFilename(); } + StringRef getRelativePath() const; unsigned getLine() const { return Line; } unsigned getColumn() const { return Column; } }; diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp index fc6f5f1c7586..3c6665bbcb7e 100644 --- a/llvm/lib/IR/DiagnosticInfo.cpp +++ b/llvm/lib/IR/DiagnosticInfo.cpp @@ -121,6 +121,10 @@ DiagnosticLocation::DiagnosticLocation(const DISubprogram *SP) { Column = 0; } +StringRef DiagnosticLocation::getRelativePath() const { + return File->getFilename(); +} + std::string DiagnosticLocation::getAbsolutePath() const { StringRef Name = File->getFilename(); if (sys::path::is_absolute(Name))