aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-06 08:53:51 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-06 08:53:51 +0000
commit48f5e63aec3f2fda7f1e75565bcbba08a9d6a14f (patch)
tree86aff0f8d7678004de094246f07b23bd03a5f71e
parent5dbad3d46c43e8051dac0c3775bcbaf8f1a6b8fe (diff)
compare.c also needs a target triple now, and improve some comments while we're
at it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86243 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp14
-rw-r--r--test/Sema/compare.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index d92f4b99ff..7f71f9c66b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4450,8 +4450,8 @@ QualType Sema::CheckShiftOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
/// \param lex the left-hand expression
/// \param rex the right-hand expression
/// \param OpLoc the location of the joining operator
-/// \param Equality whether this is an "equality-like" join;
-/// this suppresses the warning in some cases
+/// \param Equality whether this is an "equality-like" join, which
+/// suppresses the warning in some cases
void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc,
const PartialDiagnostic &PD, bool Equality) {
QualType lt = lex->getType(), rt = rex->getType();
@@ -4479,8 +4479,8 @@ void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc,
}
// If the unsigned type is strictly smaller than the signed type,
- // then (1) the result type will be signed and (2) the unsigned type
- // will fight losslessly within the signed type, and so the result
+ // then (1) the result type will be signed and (2) the unsigned
+ // value will fit fully within the signed type, and thus the result
// of the comparison will be exact.
if (Context.getIntWidth(signedOperand->getType()) >
Context.getIntWidth(unsignedOperand->getType()))
@@ -4498,9 +4498,9 @@ void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc,
if (Equality) {
// For (in)equality comparisons, if the unsigned operand is a
- // constant no greater than the maximum signed operand, then
- // reinterpreting the signed operand as unsigned will not change
- // the result of the comparison.
+ // constant which cannot collide with a overflowed signed operand,
+ // then reinterpreting the signed operand as unsigned will not
+ // change the result of the comparison.
if (unsignedOperand->isIntegerConstantExpr(value, Context)) {
assert(!value.isSigned() && "result of unsigned expression is signed");
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 9d7168d179..01a216ffec 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify -Wsign-compare %s
+// RUN: clang-cc -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare %s
int test(char *C) { // nothing here should warn.
return C != ((void*)0);