RE: r313907 - Suppress Wsign-conversion for enums with matching underlying type

2017-09-21 Thread Keane, Erich via cfe-commits
Fixed in 313909.

-Original Message-
From: Friedman, Eli [mailto:efrie...@codeaurora.org] 
Sent: Thursday, September 21, 2017 1:14 PM
To: Keane, Erich <erich.ke...@intel.com>; cfe-commits@lists.llvm.org
Subject: Re: r313907 - Suppress Wsign-conversion for enums with matching 
underlying type

On 9/21/2017 12:58 PM, Erich Keane via cfe-commits wrote:
> Author: erichkeane
> Date: Thu Sep 21 12:58:55 2017
> New Revision: 313907
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313907=rev
> Log:
> Suppress Wsign-conversion for enums with matching underlying type
>
> As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692
>
> A non-defined enum with a backing type was always defaulting to being 
> treated as a signed type. IN the case where it IS defined, the 
> signed-ness of the actual items is used.
>
> This patch uses the underlying type's signed-ness in the non-defined 
> case to test signed-comparision.
>
> Differential Revision: https://reviews.llvm.org/D38145
>
> Modified:
>  cfe/trunk/lib/Sema/SemaChecking.cpp

Missing testcase?

-El

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r313907 - Suppress Wsign-conversion for enums with matching underlying type

2017-09-21 Thread Keane, Erich via cfe-commits
Ugg... good catch, thanks.

-Original Message-
From: Friedman, Eli [mailto:efrie...@codeaurora.org] 
Sent: Thursday, September 21, 2017 1:14 PM
To: Keane, Erich <erich.ke...@intel.com>; cfe-commits@lists.llvm.org
Subject: Re: r313907 - Suppress Wsign-conversion for enums with matching 
underlying type

On 9/21/2017 12:58 PM, Erich Keane via cfe-commits wrote:
> Author: erichkeane
> Date: Thu Sep 21 12:58:55 2017
> New Revision: 313907
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313907=rev
> Log:
> Suppress Wsign-conversion for enums with matching underlying type
>
> As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692
>
> A non-defined enum with a backing type was always defaulting to being 
> treated as a signed type. IN the case where it IS defined, the 
> signed-ness of the actual items is used.
>
> This patch uses the underlying type's signed-ness in the non-defined 
> case to test signed-comparision.
>
> Differential Revision: https://reviews.llvm.org/D38145
>
> Modified:
>  cfe/trunk/lib/Sema/SemaChecking.cpp

Missing testcase?

-El

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r313907 - Suppress Wsign-conversion for enums with matching underlying type

2017-09-21 Thread Friedman, Eli via cfe-commits

On 9/21/2017 12:58 PM, Erich Keane via cfe-commits wrote:

Author: erichkeane
Date: Thu Sep 21 12:58:55 2017
New Revision: 313907

URL: http://llvm.org/viewvc/llvm-project?rev=313907=rev
Log:
Suppress Wsign-conversion for enums with matching underlying type

As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692

A non-defined enum with a backing type was always defaulting to
being treated as a signed type. IN the case where it IS defined,
the signed-ness of the actual items is used.

This patch uses the underlying type's signed-ness in the non-defined
case to test signed-comparision.

Differential Revision: https://reviews.llvm.org/D38145

Modified:
 cfe/trunk/lib/Sema/SemaChecking.cpp


Missing testcase?

-El

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r313907 - Suppress Wsign-conversion for enums with matching underlying type

2017-09-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu Sep 21 12:58:55 2017
New Revision: 313907

URL: http://llvm.org/viewvc/llvm-project?rev=313907=rev
Log:
Suppress Wsign-conversion for enums with matching underlying type

As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692

A non-defined enum with a backing type was always defaulting to
being treated as a signed type. IN the case where it IS defined,
the signed-ness of the actual items is used.

This patch uses the underlying type's signed-ness in the non-defined
case to test signed-comparision.

Differential Revision: https://reviews.llvm.org/D38145

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=313907=313906=313907=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Sep 21 12:58:55 2017
@@ -8171,8 +8171,11 @@ struct IntRange {
 // For enum types, use the known bit width of the enumerators.
 if (const EnumType *ET = dyn_cast(T)) {
   EnumDecl *Enum = ET->getDecl();
+  // In C++11, enums without definitions can have an explicitly specified
+  // underlying type.  Use this type to compute the range.
   if (!Enum->isCompleteDefinition())
-return IntRange(C.getIntWidth(QualType(T, 0)), false);
+return IntRange(C.getIntWidth(QualType(T, 0)),
+!ET->isSignedIntegerOrEnumerationType());
 
   unsigned NumPositive = Enum->getNumPositiveBits();
   unsigned NumNegative = Enum->getNumNegativeBits();


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits