r182695 - Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri May 24 16:47:43 PDT 2013
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)
More information about the cfe-commits
mailing list