Commit Graph

21 Commits

Author SHA1 Message Date
Fariborz Jahanian 148c8c8ec2 Revert r205646 (keeping the test in its modified form) as
it is subsumed by r205521.

llvm-svn: 205718
2014-04-07 16:32:54 +00:00
Fariborz Jahanian ad95da7334 Vector [Sema]. Vector "splats" which are truncated should have a warning
with -Wconversion. // rdar://16502418

llvm-svn: 205646
2014-04-04 19:33:39 +00:00
Ted Kremenek 33ba99566f Only emit implicit constant conversion truncation warnings in reachable code. Apparently this is what GCC does, and some code depends on this. Fixes <rdar://problem/10321089>.
llvm-svn: 142716
2011-10-22 02:37:33 +00:00
Daniel Dunbar b25bfde52d Frontend: Replace -nostdinc by -nostdsysteminc (which is just system include
paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc.

llvm-svn: 141691
2011-10-11 18:20:10 +00:00
John McCall 5143181ff9 Teach -Wconversion, -Wsign-compare etc. about division and remainder.
llvm-svn: 135208
2011-07-14 22:39:48 +00:00
Douglas Gregor 364f7db063 When we're determining whether to complain about a conversion from one
enumeration type to another in C, classify enumeration constants as if
they had the type of their enclosing enumeration. Fixes
<rdar://problem/9116337>.

llvm-svn: 127514
2011-03-12 00:14:31 +00:00
Douglas Gregor a78f193e7e Warn about implicit conversions between values of different, named
enumeration types. Fixes <rdar://problem/8559831>.

llvm-svn: 126183
2011-02-22 02:45:07 +00:00
John McCall 18a2c2c0b9 Split out -Wconversion warnings about constant precision into their
own subcategory, -Wconstant-conversion, which is on by default.

Tweak the constant folder to give better results in the invalid
case of a negative shift amount.

Implements rdar://problem/6792488

llvm-svn: 118636
2010-11-09 22:22:12 +00:00
John McCall acf0ee57b6 Track the location of the context requiring an implicit conversion and use it
to white-list conversions required by system headers.  rdar://problem/8232669

llvm-svn: 116029
2010-10-08 02:01:28 +00:00
Douglas Gregor 8014df4c21 Refer to implicit "conversions" rather than implicit "casts", which
don't technically exist in the language. <rdar://problem/8085982>

llvm-svn: 107995
2010-07-09 18:18:35 +00:00
John McCall cc7e5bff5c 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.

llvm-svn: 103174
2010-05-06 08:58:33 +00:00
John McCall ff96ccd337 Don't assert on compound assignment operators that operate in FP types when
the result is integral.  Fixes <rdar://problem/7676608>.

llvm-svn: 96970
2010-02-23 19:22:29 +00:00
John McCall 81472e34b2 Make this test not rely on the system <limits.h>. Hopefully fixes the
MSVC build.

llvm-svn: 95932
2010-02-11 22:45:16 +00:00
John McCall 739908faf6 Test case for warnings with carets inside macro instantiations.
llvm-svn: 95893
2010-02-11 18:52:49 +00:00
Mike Stump 0978af83b3 Insulate these from changes to the default for -Wunreachable-code.
llvm-svn: 94326
2010-01-23 20:12:18 +00:00
John McCall 2ce81adbb3 Derive tighter ranges for & and >> in the conversion-checking code.
llvm-svn: 92862
2010-01-06 22:07:33 +00:00
John McCall 70aa5391dd 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.

llvm-svn: 92823
2010-01-06 05:24:50 +00:00
Daniel Dunbar 8fbe78f6fc 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).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
John McCall 5055e4cdfd Fix PR 5422: handle lvalue results when evaluating 'based' ptrtoints as part of
the -Wconversion check.

llvm-svn: 86891
2009-11-11 22:52:37 +00:00
John McCall b397956338 Improve -Wconversion by permitting binary operations on values of the target
type (or smaller) to stay "closed" within the type.

llvm-svn: 86356
2009-11-07 08:15:46 +00:00
John McCall 554e857cf4 Test case for -Wconversion.
llvm-svn: 86327
2009-11-07 03:30:38 +00:00