<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Being fully pedantic, this still isn't correct if <i>both</i> offsets are invalid.</div><div><br></div><br><div><div>On May 24, 2013, at 16:47 , Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: akirtzidis<br>Date: Fri May 24 18:47:43 2013<br>New Revision: 182695<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=182695&view=rev">http://llvm.org/viewvc/llvm-project?rev=182695&view=rev</a><br>Log:<br>Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.<br><br>Suggested by Jordan.<br><br>Modified:<br>   cfe/trunk/lib/Basic/SourceManager.cpp<br><br>Modified: cfe/trunk/lib/Basic/SourceManager.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=182695&r1=182694&r2=182695&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=182695&r1=182694&r2=182695&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Basic/SourceManager.cpp (original)<br>+++ cfe/trunk/lib/Basic/SourceManager.cpp Fri May 24 18:47:43 2013<br>@@ -2039,8 +2039,11 @@ bool SourceManager::isBeforeInTranslatio<br>  std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);<br>  std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);<br><br>+  // getDecomposedLoc may have failed to return a valid FileID because, e.g. it<br>+  // is a serialized one referring to a file that was removed after we loaded<br>+  // the PCH.<br>  if (LOffs.first.isInvalid() || ROffs.first.isInvalid())<br>-    return false;<br>+    return LOffs.first.isInvalid();<br><br>  // If the source locations are in the same file, just compare offsets.<br>  if (LOffs.first == ROffs.first)<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div><br></body></html>