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

Benjamin Kramer benny.kra at gmail.com
Mon Sep 10 01:40:16 PDT 2012


On 10.09.2012, at 08:56, Ted Kremenek <kremenek at apple.com> wrote:

> Author: kremenek
> Date: Mon Sep 10 01:56:07 2012
> New Revision: 163490
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=163490&view=rev
> Log:
> Use isBeforeInTranslationUnitThan() instead of operator<.
> 
> 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=163490&r1=163489&r2=163490&view=diff
> ==============================================================================
> --- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
> +++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Mon Sep 10 01:56:07 2012
> @@ -215,11 +215,11 @@
>   FullSourceLoc XSL = X.getStartLocation().asLocation();
>   FullSourceLoc YSL = Y.getStartLocation().asLocation();
>   if (XSL != YSL)
> -    return XSL < YSL;
> +    return XSL.isBeforeInTranslationUnitThan(YSL);
>   FullSourceLoc XEL = X.getStartLocation().asLocation();
>   FullSourceLoc YEL = Y.getStartLocation().asLocation();
>   if (XEL != YEL)
> -    return XEL < YEL;
> +    return XEL.isBeforeInTranslationUnitThan(YEL);

You're comparing the start locations twice.

- Ben

>   return llvm::Optional<bool>();
> }
> 
> @@ -235,15 +235,15 @@
>   FullSourceLoc X_CEL = X.callEnter.asLocation();
>   FullSourceLoc Y_CEL = Y.callEnter.asLocation();
>   if (X_CEL != Y_CEL)
> -    return X_CEL < Y_CEL;
> +    return X_CEL.isBeforeInTranslationUnitThan(Y_CEL);
>   FullSourceLoc X_CEWL = X.callEnterWithin.asLocation();
>   FullSourceLoc Y_CEWL = Y.callEnterWithin.asLocation();
>   if (X_CEWL != Y_CEWL)
> -    return X_CEWL < Y_CEWL;
> +    return X_CEWL.isBeforeInTranslationUnitThan(Y_CEWL);
>   FullSourceLoc X_CRL = X.callReturn.asLocation();
>   FullSourceLoc Y_CRL = Y.callReturn.asLocation();
>   if (X_CRL != Y_CRL)
> -    return X_CRL < Y_CRL;
> +    return X_CRL.isBeforeInTranslationUnitThan(Y_CRL);
>   return comparePath(X.path, Y.path);
> }
> 
> @@ -255,7 +255,7 @@
>   FullSourceLoc XL = X.getLocation().asLocation();
>   FullSourceLoc YL = Y.getLocation().asLocation();
>   if (XL != YL)
> -    return XL < YL;
> +    return XL.isBeforeInTranslationUnitThan(YL);
> 
>   if (X.getString() != Y.getString())
>     return X.getString() < Y.getString();
> @@ -305,7 +305,7 @@
>   FullSourceLoc XL = X.getLocation().asLocation();
>   FullSourceLoc YL = Y.getLocation().asLocation();
>   if (XL != YL)
> -    return XL < YL;
> +    return XL.isBeforeInTranslationUnitThan(YL);
>   if (X.getBugType() != Y.getBugType())
>     return X.getBugType() < Y.getBugType();
>   if (X.getCategory() != Y.getCategory())
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list