Prechádzať zdrojové kódy

Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.

Suggested by Jordan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182695 91177308-0d34-0410-b5e6-96231b3b80d8
Argyrios Kyrtzidis 12 rokov pred
rodič
commit
ecdbbfa1cd
1 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  1. 4 1
      lib/Basic/SourceManager.cpp

+ 4 - 1
lib/Basic/SourceManager.cpp

@@ -2039,8 +2039,11 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
   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)