[cfe-commits] r163531 - /cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Ted Kremenek kremenek at apple.com
Mon Sep 10 12:02:33 PDT 2012


Author: kremenek
Date: Mon Sep 10 14:02:33 2012
New Revision: 163531

URL: http://llvm.org/viewvc/llvm-project?rev=163531&view=rev
Log:
Add a few more cases where we should be using isBeforeInTranslationUnit().

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=163531&r1=163530&r2=163531&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Mon Sep 10 14:02:33 2012
@@ -263,13 +263,15 @@
   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());
     }
   }
   





More information about the cfe-commits mailing list