r211142 - Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assertion of its condition. Suggestion from David Blaikie.
Craig Topper
craig.topper at gmail.com
Tue Jun 17 22:13:11 PDT 2014
Author: ctopper
Date: Wed Jun 18 00:13:11 2014
New Revision: 211142
URL: http://llvm.org/viewvc/llvm-project?rev=211142&view=rev
Log:
Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assertion of its condition. Suggestion from David Blaikie.
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=211142&r1=211141&r2=211142&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jun 18 00:13:11 2014
@@ -5370,7 +5370,9 @@ static void DiagnoseOutOfRangeComparison
if (OtherRange.NonNegative) {
if (OtherWidth >= Value.getActiveBits())
return;
- } else if (!OtherRange.NonNegative && !ConstantSigned) {
+ } else { // OtherSigned
+ assert(!ConstantSigned &&
+ "Two signed types converted to unsigned types.");
// Check to see if the constant is representable in OtherT.
if (OtherWidth > Value.getActiveBits())
return;
@@ -5384,8 +5386,6 @@ static void DiagnoseOutOfRangeComparison
// after conversion. Relational comparison still works, but equality
// comparisons will be tautological.
EqualityOnly = true;
- } else { // OtherSigned && ConstantSigned
- llvm_unreachable("Two signed types converted to unsigned types.");
}
}
More information about the cfe-commits
mailing list