r265323 - Add a couple of convenience operations to CharUnits.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 11:58:30 PDT 2016


> On Apr 4, 2016, at 11:49 AM, Sean Silva <chisophugis at gmail.com> wrote:
> On Mon, Apr 4, 2016 at 11:33 AM, John McCall via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
> Author: rjmccall
> Date: Mon Apr  4 13:33:00 2016
> New Revision: 265323
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=265323&view=rev <http://llvm.org/viewvc/llvm-project?rev=265323&view=rev>
> Log:
> Add a couple of convenience operations to CharUnits.
> 
> Modified:
>     cfe/trunk/include/clang/AST/CharUnits.h
> 
> Modified: cfe/trunk/include/clang/AST/CharUnits.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=265323&r1=265322&r2=265323&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=265323&r1=265322&r2=265323&view=diff>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CharUnits.h (original)
> +++ cfe/trunk/include/clang/AST/CharUnits.h Mon Apr  4 13:33:00 2016
> @@ -142,9 +142,17 @@ namespace clang {
>        CharUnits operator* (QuantityType N) const {
>          return CharUnits(Quantity * N);
>        }
> +      CharUnits &operator*= (QuantityType N) {
> +        Quantity *= N;
> +        return *this;
> +      }
>        CharUnits operator/ (QuantityType N) const {
>          return CharUnits(Quantity / N);
>        }
> +      CharUnits operator/= (QuantityType N) {
> 
> Should this return type be a reference like the one for operator*=?

Yes, absolutely.  Fixed in r265328, thanks.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160404/981d2bd6/attachment.html>


More information about the cfe-commits mailing list