From: Ted Kremenek Date: Mon, 10 Sep 2012 19:02:33 +0000 (+0000) Subject: Add a few more cases where we should be using isBeforeInTranslationUnit(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d727d39ca779920898d77f5dcbbb3980175594ef;p=clang 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 --- 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 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()); } }