aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-09-10 19:02:33 +0000
committerTed Kremenek <kremenek@apple.com>2012-09-10 19:02:33 +0000
commitd727d39ca779920898d77f5dcbbb3980175594ef (patch)
tree18e23453cce956ff0dc92dd79950b9e1c18a61ca /lib/StaticAnalyzer/Core/PathDiagnostic.cpp
parent776da9e05efadf86e4d7cc177d8ff2b1a0953319 (diff)
Add a few more cases where we should be using isBeforeInTranslationUnit().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/PathDiagnostic.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
index 73694a6994..f51e16c084 100644
--- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
+++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
@@ -263,13 +263,15 @@ static llvm::Optional<bool> comparePiece(const PathDiagnosticPiece &X,
if (X.getRanges().size() != Y.getRanges().size())
return X.getRanges().size() < Y.getRanges().size();
+ const SourceManager &SM = XL.getManager();
+
for (unsigned i = 0, n = X.getRanges().size(); i < n; ++i) {
SourceRange XR = X.getRanges()[i];
SourceRange YR = Y.getRanges()[i];
if (XR != YR) {
if (XR.getBegin() != YR.getBegin())
- return XR.getBegin() < YR.getBegin();
- return XR.getEnd() < YR.getEnd();
+ return SM.isBeforeInTranslationUnit(XR.getBegin(), YR.getBegin());
+ return SM.isBeforeInTranslationUnit(XR.getEnd(), YR.getEnd());
}
}