diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-05-24 23:47:43 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-05-24 23:47:43 +0000 |
commit | 5fd822c28369d6c2c530816e8bda1ffd135b807f (patch) | |
tree | a0569168606d8fd08398d773b0a6706acd4d708b /clang/lib/Basic/SourceManager.cpp | |
parent | 9eea764a1fafb5883286b088422e2ec77db25dec (diff) | |
download | llvm-5fd822c28369d6c2c530816e8bda1ffd135b807f.zip llvm-5fd822c28369d6c2c530816e8bda1ffd135b807f.tar.gz llvm-5fd822c28369d6c2c530816e8bda1ffd135b807f.tar.bz2 |
Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.
Suggested by Jordan.
llvm-svn: 182695
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index a4f4f9d..dfd2a1b 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/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) |