Don't warn -Wsign-compare if we're in an unevaluated context, and fixed

a typo pointed out by Fariborz.

llvm-svn: 86265
This commit is contained in:
John McCall 2009-11-06 18:16:06 +00:00
parent 68d2417e05
commit e2c91e6b26
2 changed files with 5 additions and 1 deletions

View File

@ -160,6 +160,6 @@ def : DiagGroup<"", [Extra]>; // -W = -Wextra
def : DiagGroup<"endif-labels", [ExtraTokens]>; // endif-labels = endif-tokens
// A warning group for warnings that we want to have on by default in clang,
// but which aren't no by default in GCC.
// but which aren't on by default in GCC.
def NonGCC : DiagGroup<"non-gcc",
[SignCompare]>;

View File

@ -4454,6 +4454,10 @@ QualType Sema::CheckShiftOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
/// suppresses the warning in some cases
void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc,
const PartialDiagnostic &PD, bool Equality) {
// Don't warn if we're in an unevaluated context.
if (ExprEvalContext == Unevaluated)
return;
QualType lt = lex->getType(), rt = rex->getType();
// Only warn if both operands are integral.