r182695 - Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.
Jordan Rose
jordan_rose at apple.com
Fri May 24 17:03:47 PDT 2013
Being fully pedantic, this still isn't correct if both offsets are invalid.
On May 24, 2013, at 16:47 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Author: akirtzidis
> Date: Fri May 24 18:47:43 2013
> New Revision: 182695
>
> URL: http://llvm.org/viewvc/llvm-project?rev=182695&view=rev
> Log:
> Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.
>
> Suggested by Jordan.
>
> Modified:
> cfe/trunk/lib/Basic/SourceManager.cpp
>
> Modified: cfe/trunk/lib/Basic/SourceManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=182695&r1=182694&r2=182695&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/SourceManager.cpp (original)
> +++ cfe/trunk/lib/Basic/SourceManager.cpp Fri May 24 18:47:43 2013
> @@ -2039,8 +2039,11 @@ bool SourceManager::isBeforeInTranslatio
> std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);
> std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);
>
> + // getDecomposedLoc may have failed to return a valid FileID because, e.g. it
> + // is a serialized one referring to a file that was removed after we loaded
> + // the PCH.
> if (LOffs.first.isInvalid() || ROffs.first.isInvalid())
> - return false;
> + return LOffs.first.isInvalid();
>
> // If the source locations are in the same file, just compare offsets.
> if (LOffs.first == ROffs.first)
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130524/4d4c313f/attachment.html>
More information about the cfe-commits
mailing list