<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 25, 2016 at 5:22 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hans added inline comments.<br>
<span class=""><br>
================<br>
Comment at: lib/Frontend/TextDiagnostic.<wbr>cpp:770-777<br>
@@ +769,10 @@<br>
+  if (DiagOpts->AbsolutePath) {<br>
+    const DirectoryEntry *Dir = SM.getFileManager().<wbr>getDirectory(<br>
+        llvm::sys::path::parent_path(<wbr>Filename));<br>
+    if (Dir) {<br>
+      StringRef DirName = SM.getFileManager().<wbr>getCanonicalName(Dir);<br>
+      llvm::sys::path::append(<wbr>AbsoluteFilename, DirName,<br>
+                              llvm::sys::path::filename(<wbr>Filename));<br>
+      Filename = StringRef(AbsoluteFilename.<wbr>data(), AbsoluteFilename.size());<br>
+    }<br>
+  }<br>
----------------<br>
</span><span class="">rsmith wrote:<br>
> 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.<br>
</span>If I understand correctly, getCanonicalName only works with a DirectoryEntry, which is supposed to be a directory, not a full path to a file. So I didn't see any other way than getting the canonical name for the dir, and then joining it with the filename.</blockquote><div><br></div><div>Huh, so it does. That's an odd choice. Anyway, let's go with this, unless you feel like refactoring it to work on an arbitrary path.</div></div></div></div>