[llvm-commits] [llvm] r94117 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

Bill Wendling wendling at apple.com
Thu Jan 21 15:54:41 PST 2010


On Jan 21, 2010, at 3:42 PM, Ted Kremenek wrote:

> Author: kremenek
> Date: Thu Jan 21 17:42:57 2010
> New Revision: 94117
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=94117&view=rev
> Log:
> Tidy up assertion syntax.  No functionality change.
> 
> Modified:
>    llvm/trunk/include/llvm/ADT/ImmutableSet.h
> 
> Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=94117&r1=94116&r2=94117&view=diff
> 
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
> +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Thu Jan 21 17:42:57 2010
> @@ -190,23 +190,22 @@
>     unsigned HL = getLeft() ? getLeft()->verify() : 0;
>     unsigned HR = getRight() ? getRight()->verify() : 0;
> 
> -    assert (getHeight() == ( HL > HR ? HL : HR ) + 1
> -            && "Height calculation wrong.");
> +    assert(getHeight() == ( HL > HR ? HL : HR ) + 1
> +            && "Height calculation wrong");
> 
> -    assert ((HL > HR ? HL-HR : HR-HL) <= 2
> -            && "Balancing invariant violated.");
> +    assert((HL > HR ? HL-HR : HR-HL) <= 2
> +           && "Balancing invariant violated");
> 
> -
> -    assert (!getLeft()
> -            || ImutInfo::isLess(ImutInfo::KeyOfValue(getLeft()->getValue()),
> -                                ImutInfo::KeyOfValue(getValue()))
> -            && "Value in left child is not less that current value.");
> -
> -
> -    assert (!getRight()
> -            || ImutInfo::isLess(ImutInfo::KeyOfValue(getValue()),
> -                                ImutInfo::KeyOfValue(getRight()->getValue()))
> -            && "Current value is not less that value of right child.");
> +    assert(!getLeft()
> +           || ImutInfo::isLess(ImutInfo::KeyOfValue(getLeft()->getValue()),
> +                               ImutInfo::KeyOfValue(getValue()))
> +           && "Value in left child is not less that current value");
> +
> +
> +    assert(!getRight()
> +           || ImutInfo::isLess(ImutInfo::KeyOfValue(getValue()),
> +                               ImutInfo::KeyOfValue(getRight()->getValue()))
> +           && "Current value is not less that value of right child");
> 
Would it be good to put the "or" part in parentheses to make this more readable for people who don't have the precedence table memorized? :-)

-bw





More information about the llvm-commits mailing list