[PATCH] D23816: Add support for -fdiagnostics-abs-path: printing absolute paths in diagnostics
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 25 17:15:45 PDT 2016
rsmith accepted this revision.
================
Comment at: lib/Frontend/TextDiagnostic.cpp:770-777
@@ +769,10 @@
+ if (DiagOpts->AbsolutePath) {
+ const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
+ llvm::sys::path::parent_path(Filename));
+ if (Dir) {
+ StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
+ llvm::sys::path::append(AbsoluteFilename, DirName,
+ llvm::sys::path::filename(Filename));
+ Filename = StringRef(AbsoluteFilename.data(), AbsoluteFilename.size());
+ }
+ }
----------------
Why split off the filename and rejoin it here? Is this to better handle cases where the directory exists but the file doesn't, or an attempt to avoid resolving file symlinks? A comment in the code explaining this would be useful.
https://reviews.llvm.org/D23816
More information about the cfe-commits
mailing list