[cfe-commits] r73820 - /cfe/trunk/include/clang/Basic/SourceLocation.h

Ted Kremenek kremenek at apple.com
Mon Jun 22 10:18:48 PDT 2009


Hi Argiris,

I was looking at this patch, and it wasn't clear to me how is this  
useful?  Looking at the definition of operator<= tells me little about  
its intended semantics or when it is intended to be used.  My concern  
is that some users may expect operator<= to have some notion of line  
and column comparisons, which certainly isn't the case.  Do we really  
need to use operator overloading?  If so, could you add a comment of  
where this is intended to be used?

Thanks,
Ted

On Jun 20, 2009, at 1:08 AM, Argiris Kirtzidis wrote:

> Author: akirtzidis
> Date: Sat Jun 20 03:08:38 2009
> New Revision: 73820
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73820&view=rev
> Log:
> Add operator '<=' for comparing SourceLocations.
>
> Modified:
>    cfe/trunk/include/clang/Basic/SourceLocation.h
>
> Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=73820&r1=73819&r2=73820&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
> +++ cfe/trunk/include/clang/Basic/SourceLocation.h Sat Jun 20  
> 03:08:38 2009
> @@ -145,6 +145,10 @@
>   return LHS.getRawEncoding() < RHS.getRawEncoding();
> }
>
> +inline bool operator<=(const SourceLocation &LHS, const  
> SourceLocation &RHS) {
> +  return LHS.getRawEncoding() <= RHS.getRawEncoding();
> +}
> +
> /// SourceRange - a trival tuple used to represent a source range.
> class SourceRange {
>   SourceLocation B;
>
>
> _______________________________________________
> 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