Index: include-fixer/find-all-symbols/FindAllSymbols.cpp =================================================================== --- include-fixer/find-all-symbols/FindAllSymbols.cpp +++ include-fixer/find-all-symbols/FindAllSymbols.cpp @@ -16,6 +16,7 @@ #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" using namespace clang::ast_matchers; @@ -57,8 +58,18 @@ std::string FilePath = Result.SourceManager->getFilename(Loc).str(); if (FilePath.empty()) return false; + auto WorkingDir = Result.SourceManager->getFileManager() + .getVirtualFileSystem() + ->getCurrentWorkingDirectory(); + if (WorkingDir) { + llvm::SmallString<128> AbsolutePath(*WorkingDir); + llvm::sys::path::append(AbsolutePath, FilePath); + llvm::sys::path::remove_dots(AbsolutePath, true); + Symbol->FilePath = AbsolutePath.str(); + } else { + Symbol->FilePath = FilePath; + } - Symbol->FilePath = FilePath; Symbol->LineNumber = Result.SourceManager->getExpansionLineNumber(Loc); return true; }