forked from OSchip/llvm-project
Turn the mixed-sign-comparison diagnostic into a runtime behavior
diagnostic, from Eitan Adler! llvm-svn: 155876
This commit is contained in:
parent
b52637051f
commit
bfb4a2138c
|
@ -3952,9 +3952,10 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) {
|
|||
return;
|
||||
}
|
||||
|
||||
S.Diag(E->getOperatorLoc(), diag::warn_mixed_sign_comparison)
|
||||
<< LHS->getType() << RHS->getType()
|
||||
<< LHS->getSourceRange() << RHS->getSourceRange();
|
||||
S.DiagRuntimeBehavior(E->getOperatorLoc(), E,
|
||||
S.PDiag(diag::warn_mixed_sign_comparison)
|
||||
<< LHS->getType() << RHS->getType()
|
||||
<< LHS->getSourceRange() << RHS->getSourceRange());
|
||||
}
|
||||
|
||||
/// Analyzes an attempt to assign the given value to a bitfield.
|
||||
|
|
|
@ -333,3 +333,10 @@ struct test11S { unsigned x : 30; };
|
|||
int test11(unsigned y, struct test11S *p) {
|
||||
return y > (p->x >> 24); // no-warning
|
||||
}
|
||||
|
||||
typedef char one_char[1];
|
||||
typedef char two_chars[2];
|
||||
|
||||
void test12(unsigned a) {
|
||||
if (0 && -1 > a) { }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue