<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 11, 2011, at 10:38 AM, Zhanyong Wan (λx.x x) wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Thanks, Doug!<br><br>2011/2/10 Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>>:<br><blockquote type="cite">Hi Zhanyong,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Your patch looks good to me. Did you consider using the functionality in llvm::sys::path to handle the parsing of path names, rather than hand-coding string algorithm such as<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+void FileManager::addAncestorsAsVirtualDirs(llvm::StringRef Path) {<br></blockquote><blockquote type="cite">+  size_t SlashPos = Path.size();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+  // Find the beginning of the last segment in Path.<br></blockquote><blockquote type="cite">+  while (SlashPos != 0 && !IS_DIR_SEPARATOR_CHAR(Path[SlashPos-1]))<br></blockquote><blockquote type="cite">+    --SlashPos;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+  // Ignore repeated //'s.<br></blockquote><blockquote type="cite">+  while (SlashPos != 0 && IS_DIR_SEPARATOR_CHAR(Path[SlashPos-1]))<br></blockquote><blockquote type="cite">+    --SlashPos;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+  if (SlashPos == 0)<br></blockquote><blockquote type="cite">+    return;<br></blockquote><br>I wasn't aware of llvm::sys::path, so I just followed what the<br>existing code in FileManager was doing.  I like the idea of switching<br>to llvm::sys::path.<br><br>May I commit the patch as is and send you a separate one for using<br>llvm::sys::path?  Thanks,<br></div></blockquote></div><br><div>Yes, that's fine. Thanks!</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">     </span>- Doug</div></body></html>