History log of /external/clang/test/Sema/compare.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7adf3a9f84688f334a1cd977317bb42f9e06c9f4 15-Mar-2013 Ted Kremenek <kremenek@apple.com> Enhance -Wtautological-constant-out-of-range-compare to include the name of the enum constant.

This is QoI. Fixes <rdar://problem/13076064>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
a193f20916f0e0e5a3b0f76ca69e2b3870c1a325 20-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> Improvements to my patch in r164143 per
Richard's comments. // rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
15a9356464f0809e1cb24aa3a7cc2577914ff5bb 18-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> c: warn when an integer value comparison with an
integral expression have the obvious result.
Patch reviewed by John McCall off line.
// rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
6d3b93d631640125f912339df19b0d2a15af5c9b 01-May-2012 Douglas Gregor <dgregor@apple.com> Turn the mixed-sign-comparison diagnostic into a runtime behavior
diagnostic, from Eitan Adler!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
b17ee5bff0d7986c14cdddb279e0131bd7f9678d 15-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Enhance the -Wsign-compare handling to suppress the -Wsign-compare warning in the case of a shifted bitfield. PR11572.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
862ff87c0d306af8dfdbe7ac59f181a5815546e5 13-Jul-2011 John McCall <rjmccall@apple.com> Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple
assignments.

The first is PR10336.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
372e103dab4239ec52b65b9eda69fd43c0b348d4 06-Oct-2010 John McCall <rjmccall@apple.com> Provide a slightly specialized diagnostic for tautological comparisons
of an enum value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
e3b159c0d4a93db8586861ff011b5a10de4ae6ef 23-Sep-2010 Ted Kremenek <kremenek@apple.com> When warning about comparing an unsigned int to being >= 0, don't issue a warning if the zero value was an
enum or was expanded from a macro.

Fixes: <rdar://problem/8414119>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
d64fdd0c056f1e50488519254f852fa8050f0470 08-Jun-2010 Douglas Gregor <dgregor@apple.com> Warn about comparisons between arrays and improve self-comparison
warnings, from Troy Straszheim! Fixes PR6163.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
323ed74658bc8375278eabf074b4777458376540 06-May-2010 John McCall <rjmccall@apple.com> Rearchitect -Wconversion and -Wsign-compare. Instead of computing them
"bottom-up" when implicit casts and comparisons are inserted, compute them
"top-down" when the full expression is finished. Makes it easier to
coordinate warnings and thus implement -Wconversion for signedness
conversions without double-warning with -Wsign-compare. Also makes it possible
to realize that a signedness conversion is okay because the context is
performing the inverse conversion. Also simplifies some logic that was
trying to calculate the ultimate comparison/result type and getting it wrong.
Also fixes a problem with the C++ explicit casts which are often "implemented"
in the AST with a series of implicit cast expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
3aae6093dd8f3aecb66d7ff1f4b44e6a86765db4 07-Apr-2010 John McCall <rjmccall@apple.com> Teach -Wsign-compare to treat 1 << blah as "idiomatically non-negative".
Fixes a spurious warning in LLVM.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
d1b47bf17fde73fac67d8664bd65273742c00ecd 11-Mar-2010 John McCall <rjmccall@apple.com> Warn about comparing an unsigned expression with 0 in tautological ways.
Patch by mikem!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
46171917dc87caf0c7a741a7301f36db2e20b132 23-Jan-2010 Mike Stump <mrs@apple.com> Insulate these from changes to the default for -Wunreachable-code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
0acc311bf73c85fd34ce6f89a4e786b7ecd214aa 06-Jan-2010 John McCall <rjmccall@apple.com> Don't assert when dealing with unsigned casts of lvalues. Fixes PR5961.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
f2370c9b4aade940e2253b5b33262ba507d1d71f 06-Jan-2010 John McCall <rjmccall@apple.com> Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics. The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.

Fixes PRs 5887, 5937, 5938, and 5939.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
bc021702e67a1c11d72a926f995cf418bb456315 04-Jan-2010 John McCall <rjmccall@apple.com> -Wsign-compare shouldn't warn when the signed operand is a conditional operator
whose operands are non-negative integer constant expressions. This comes up
in LLVM in a few places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
842aef8d942a880eeb9535d40de31a86838264cb 09-Dec-2009 John McCall <rjmccall@apple.com> First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to. This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.

Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
48f5e63aec3f2fda7f1e75565bcbba08a9d6a14f 06-Nov-2009 John McCall <rjmccall@apple.com> 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
/external/clang/test/Sema/compare.c
5dbad3d46c43e8051dac0c3775bcbaf8f1a6b8fe 06-Nov-2009 John McCall <rjmccall@apple.com> Improve the -Wsign-compare heuristics:
* If the unsigned type is smaller than the signed type, never warn, because
its value will not change when zero-extended to the larger type.
* If we're testing for (in)equality, and the unsigned value is an integer
constant whose sign bit is not set, never warn, because even though the
signed value might change, it can't affect the result of the equality.

Also make the comparison test cases much more rigorous, and have them expose
the subtle differences between C and C++ here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
35de813674503b87ec5117b6492cc0a4ef7d8728 06-Nov-2009 Douglas Gregor <dgregor@apple.com> Turn off -Wsign-compare warnings by default

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
b13c87f0c9705d91d5a3e134be9934c9ad531071 05-Nov-2009 John McCall <rjmccall@apple.com> Implement the conditional-operator part of -Wsign-compare. Turn
DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places.

Add some enumerator tests. These seem to expose some oddities in the
types we're converting C++ enumerators to; in particular, they're converting
to unsigned before int, which seems to contradict 4.5 [conv.prom] p2.

Note to self: stop baiting Doug in my commit messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
45aa4557fe4210034e85f4a807ff637a9dd146d6 05-Nov-2009 John McCall <rjmccall@apple.com> Implement -Wsign-compare, or at least the actual comparison part of it.
Conditional operands are next.

Fixes part of rdar://problem/7289584.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
cc6be895054188221f7d276f2579fc2d1e8bb224 27-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Remove unnecessary include.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
3075e760ceb73b6fafc2fb4977ad68552d83aef8 23-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Catch a few more cases of illegal comparisons.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
06c0f5b1bb1623a93a2bc4c345fb3be52a2b22a7 23-Aug-2009 Chris Lattner <sabre@nondot.org> Eli points out that we really must diagnose "void* > 0" as an extension.
Explicitly add it as an EXTENSION instead of an EXTWARN so that it only
comes out with -pedantic. Thanks Eli!




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
6365e3e22bcec4b95c5b1ed47d501134b375a75a 22-Aug-2009 Chris Lattner <sabre@nondot.org> tweak some pointer sema checking stuff (which was added to implement PR4175) to
avoid emitting a warning on "someptr > 0". This is obviously questionable (they
could use != instead) but is reasonable, and the warning "ordered comparison
between pointer and integer" didn't make a ton of sense because 0 is a valid
null pointer constant.

Just silence the warning in this case, it is unlikely to indicate a bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
f93343764765b24f53e389c7dd35f90901925451 06-Jul-2009 Douglas Gregor <dgregor@apple.com> Fix a problem with false diagnostics when comparing distinct NULL pointer types, from David Majnemer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
149f1386c60aa07de0f6a5d43ab524b22af68059 30-Jun-2009 Chris Lattner <sabre@nondot.org> Implement PR4175, catching some questionable comparisons. Patch by
David Majnemer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
d7d5f0223bd30dfd618762349c6209dd1d5ea3e6 24-Mar-2009 Daniel Dunbar <daniel@zuster.org> Rename clang to clang-cc.

Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
4e92acf3b747b994e50fbf7bfe8ef71cdda20c50 06-Feb-2008 Eli Friedman <eli.friedman@gmail.com> Be a bit stricter about array type compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
3b427b3ba518f7a7293458c2d3d92eebd8458d87 11-Oct-2007 Chris Lattner <sabre@nondot.org> rename -parse-ast-print to -ast-print
rename -parse-ast-dump to -ast-dump
remove -parse-ast, which is redundant with -fsyntax-only



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
9f3d942e9970bc8f51add390b2a2c46b5a2ab747 26-Sep-2007 Ted Kremenek <kremenek@apple.com> Removed option "-parse-ast-check" from clang driver. This is now implemented
using "-parse-ast -verify".

Updated all test cases (using a sed script) that invoked -parse-ast-check to
now use -parse-ast -verify.

Fixed a bug where using "-verify" instead of "-parse-ast-check" would not
correctly create the DiagClient needed to accumulate diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
77878cc5aa6ad01fc0c91bac1a61819dbf3bf691 27-Aug-2007 Steve Naroff <snaroff@apple.com> Add Type::getAsBuiltinType() and Type::builtinTypesAreCompatible().
Modified Type::typesAreCompatible() to use the above.

This fixes the following bug submitted by Keith Bauer (thanks!).

int equal(char *a, const char *b)
{
return a == b;
}

Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when
comparing two pointer types (though it doesn't relate directly to this bug).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c
d28f815705497f23c2747d61b7834f2d7ea78283 26-Aug-2007 Chris Lattner <sabre@nondot.org> Cases like this:
char *C;
C != ((void*)0);

Should not warn about incompatible pointer types. Also, make sure to
insert an implicit conversion even if the operand is null.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/compare.c