[llvm-commits] [llvm] r159532 - /llvm/trunk/include/llvm/Support/IntegersSubset.h

David Blaikie dblaikie at gmail.com
Mon Jul 2 09:31:50 PDT 2012


On Mon, Jul 2, 2012 at 7:10 AM, Stepan Dyatkovskiy <stpworld at narod.ru> wrote:
> Author: dyatkovskiy
> Date: Mon Jul  2 09:10:46 2012
> New Revision: 159532
>
> URL: http://llvm.org/viewvc/llvm-project?rev=159532&view=rev
> Log:
> IntRange, fixed warning in isSingleNumber method
>
> Modified:
>     llvm/trunk/include/llvm/Support/IntegersSubset.h
>
> Modified: llvm/trunk/include/llvm/Support/IntegersSubset.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IntegersSubset.h?rev=159532&r1=159531&r2=159532&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/IntegersSubset.h (original)
> +++ llvm/trunk/include/llvm/Support/IntegersSubset.h Mon Jul  2 09:10:46 2012
> @@ -210,8 +210,7 @@
>          return true;
>        case RANGE:
>          return false;
> -      case UNKNOWN:
> -      default:
> +      default: // UNKNOWN

If you only meant to handle UNKNOWN here and not any other cases that
might be added later, the correct fix would've been to remove the
default rather than removing the case. (please fix if that's the case
- otherwise do nothing)

[The purpose of the warning is to ensure that we don't have
effectively unreachable defaults as they hide -Wswitch warnings which
will tell you if you later add a new enumeration & don't update all
the switches that intend to cover all cases.]

- David

>          if (Low == High) {
>            const_cast<Type&>(RangeType) = SINGLE_NUMBER;
>            return true;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list