r265323 - Add a couple of convenience operations to CharUnits.

Sean Silva via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 11:49:27 PDT 2016


On Mon, Apr 4, 2016 at 11:33 AM, John McCall via cfe-commits <
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
> 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
>
> ==============================================================================
> --- 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*=?

-- Sean Silva


> +        Quantity /= N;
> +        return *this;
> +      }
>        QuantityType operator/ (const CharUnits &Other) const {
>          return Quantity / Other.Quantity;
>        }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160404/3a32ceea/attachment.html>


More information about the cfe-commits mailing list