summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Fix false negative reported in PR 10358 by using 'Unknown' in ↵Ted Kremenek2011-07-141-4/+4
| | | | | | -Wuninitialized to avoid cascading warnings. Patch by Kaelyn Uhrain. llvm-svn: 135217
* Teach -Wconversion, -Wsign-compare etc. about division and remainder.John McCall2011-07-141-0/+8
| | | | llvm-svn: 135208
* Revert r135147 and r135075. The consensus was that this wasn't the right ↵Ted Kremenek2011-07-143-19/+4
| | | | | | thing to do. llvm-svn: 135152
* Reapply r135075, but modify format-strings.c and format-strings-fixit.c test ↵Ted Kremenek2011-07-143-4/+19
| | | | | | cases to be more portable with an explicit target triple. llvm-svn: 135134
* Revert r135075, "format string checking: long and int have the same widths ↵NAKAMURA Takumi2011-07-141-14/+0
| | | | | | | | on 32-bit, so we shouldn't warn about using" It fails on freebsd, mingw and msvc10. llvm-svn: 135129
* format string checking: long and int have the same widths on 32-bit, so we ↵Ted Kremenek2011-07-131-0/+14
| | | | | | | | shouldn't warn about using an "int" format specifier with a "long" type in 32-bit. llvm-svn: 135075
* Re-relax conversion specifier checking for printf format strings and ↵Ted Kremenek2011-07-131-2/+2
| | | | | | conversion specifiers. My recent change was a mistake. llvm-svn: 135048
* Fix inversion in argument type checking for format strings with conversion ↵Ted Kremenek2011-07-131-0/+9
| | | | | | specifiers for character types. llvm-svn: 135046
* Make the integer-range analysis recognize ^= correctly,John McCall2011-07-131-0/+15
| | | | | | | | | and (while I'm at it) teach it to grok the results of simple assignments. The first is PR10336. llvm-svn: 135034
* Silliness with commas, as reported at http://blog.regehr.org/archives/558 . ↵Eli Friedman2011-07-131-0/+1
| | | | | | As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :( llvm-svn: 135026
* Add diagnostic for constructs like "va_arg(l, float)" which have undefined ↵Eli Friedman2011-07-111-0/+9
| | | | | | behavior. PR10201. llvm-svn: 134926
* Don't complain about missing return statements for nakedDouglas Gregor2011-07-111-0/+4
| | | | | | functions. Fixes <rdar://problem/9731999>. llvm-svn: 134897
* Change -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx ↵Eli Friedman2011-07-081-2/+2
| | | | | | | | | | | | should not imply -mno-sse. Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__. clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much. <rdar://problem/9694837> llvm-svn: 134770
* Add a testcase for the previous commit and update an existing test for anEric Christopher2011-07-071-5/+5
| | | | | | | | extra register. Part of PR10299 and rdar://9740322 llvm-svn: 134657
* Fix off-by-one error in StringLiteral::getLocationOfByte.Hans Wennborg2011-06-301-0/+6
| | | | | | This fixes PR10223. llvm-svn: 134183
* Move test/Sema/return.cpp into test/SemaCXX/return.cppHans Wennborg2011-06-301-10/+0
| | | | llvm-svn: 134171
* Test for errors for returning a value from a ctor or dtor.Hans Wennborg2011-06-301-0/+10
| | | | | | This fell out when Chandler landed the patch in r134138. llvm-svn: 134163
* Check for deprecated/unavailable/etc attributes on fields that areDouglas Gregor2011-06-291-0/+2
| | | | | | initialized via initializer lists. Fixes <rdar://problem/9694686>. llvm-svn: 134099
* When redeclaring a local extern in the same scope, make sure that weDouglas Gregor2011-06-291-1/+14
| | | | | | | replace the existing declaration appropriately. Patch by Jordy Rose, fixes PR10013 / <rdar://problem/9584157>. llvm-svn: 134097
* Split out logic for valid clobbers and valid inline asm registers.Eric Christopher2011-06-281-0/+4
| | | | | | Fixes rdar://9281377 llvm-svn: 134016
* Handle nonnull attribute with optional argument number onFariborz Jahanian2011-06-271-0/+21
| | | | | | | functions with arguments of transparent unions type. // rdar://9584012 llvm-svn: 133941
* Cleanup a fixme by using a specific diagnostic for subscriptingChandler Carruth2011-06-271-1/+1
| | | | | | a pointer to void. llvm-svn: 133912
* Factor out (some of) the checking for invalid forms of pointerChandler Carruth2011-06-274-18/+18
| | | | | | | | | | | | | | | | | | | arithmetic into a couple of common routines. Use these to make the messages more consistent in the various contexts, especially in terms of consistently diagnosing binary operators with invalid types on both the left- and right-hand side. Also, improve the grammar and wording of the messages some, handling both two pointers and two (different) types. The wording of function pointer arithmetic diagnostics still strikes me as poorly phrased, and I worry this makes them slightly more awkward if more consistent. I'm hoping to fix that with a follow-on patch and test case that will also make them more helpful when a typedef or template type parameter makes the type completely opaque. Suggestions on better wording are very welcome, thanks to Richard Smith for some initial help on that front. llvm-svn: 133906
* Two more test cases which have been long uncommitted.John McCall2011-06-241-0/+8
| | | | llvm-svn: 133842
* Fix Sema::CheckVectorOperands so that it doesn't try to insert a cast ↵Eli Friedman2011-06-232-1/+8
| | | | | | | | expression into the LHS of a compound assignment. Fixes compound assignment of various "compatible" vector types, including NEON-vector and gcc-vector types. <rdar://problem/9640356> llvm-svn: 133737
* Issue warning if weak_import attribute is added to an alreadyFariborz Jahanian2011-06-221-0/+4
| | | | | | declared variable and ignore it. // rdar://9538608 llvm-svn: 133654
* Changes ParenListExpr to always require a type.Manuel Klimek2011-06-221-0/+17
| | | | | | | Removes dead code found in the process. Adds a test to verify that ParenListExprs do not have NULL types. llvm-svn: 133637
* Fix a crash when a pointer-to-member function is called in the conditionChandler Carruth2011-06-211-0/+14
| | | | | | | expression of '?:'. Add a test case for this pattern, and also test the code that led to the crash in a "working" case as well. llvm-svn: 133523
* Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.Argyrios Kyrtzidis2011-06-201-0/+6
| | | | | | Patch by Henry Mason with tweaks by me. llvm-svn: 133453
* Fix a problem with the diagnostics of invalid arithmetic with functionChandler Carruth2011-06-201-1/+2
| | | | | | | | pointers I found while working on the NULL arithmetic warning. We here always assuming the LHS was the pointer, instead of using the selected pointer expression. llvm-svn: 133428
* Don't emit 'unavailable' errors inside an unavailable function. rdar://9623855.Argyrios Kyrtzidis2011-06-171-0/+10
| | | | llvm-svn: 133264
* Make the presentation of the warnings on 'x + y ? 1 : 0' a bit moreChandler Carruth2011-06-162-24/+24
| | | | | | | | | | | | | pretty. In particular this makes it much easier for me to read messages such as: x.cc:42: ?: has lower ... Where I'm inclined to associate the third ':' with a missing column number, but in fact column numbers have been turned off. Similar punctuation collisions happened elsewhere as well. llvm-svn: 133121
* Don't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,Douglas Gregor2011-06-151-0/+5
| | | | | | | either imlicitly (for builtins) or explicitly (due to multiple specification of the same attributes). Fixes <rdar://problem/9612060>. llvm-svn: 133045
* Warn on "void f(int a[10]) { sizeof(a); }"Nico Weber2011-06-151-0/+30
| | | | llvm-svn: 133036
* Sema: show shift result in hexadecimalTed Kremenek2011-06-151-1/+1
| | | | | | | | | | | | | | | | | Change the output for -Wshift-overflow and -Wshift-sign-overflow to an unsigned hexadecimal. It makes more sense for looking at bits than a signed decimal does. Also, change the diagnostic's wording from "overrides" to "sets". This uses a new optional argument in APInt::toString() that adds the '0x' prefix to hexademical numbers. This fixes PR 9651. Patch by nobled@dreamwidth.org! llvm-svn: 133033
* Bad table discription of fromat-y2k causes Fariborz Jahanian2011-06-141-0/+9
| | | | | | | no-format-y2k turn off -Wformat altogether. // rdar://9504680 llvm-svn: 133015
* when compiling in a GNU mode (e.g. gnu99) treat VLAs with a size that can be ↵Chris Lattner2011-06-145-6/+6
| | | | | | | | | | folded to a constant as constant size arrays. This has slightly different semantics in some insane cases, but allows us to accept some constructs that GCC does. Continue to be pedantic in -std=c99 and other modes. This addressed rdar://8733881 - error "variable-sized object may not be initialized"; g++ accepts same code llvm-svn: 132983
* Properly diagnose using abstract and incomplete types in va_argDavid Majnemer2011-06-141-0/+6
| | | | | | | - Move a test from test/SemaTemplate/instantiate-expr-3.cpp, it did not belong there - Incomplete and abstract types are considered hard errors llvm-svn: 132979
* fix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.Chris Lattner2011-06-141-0/+10
| | | | llvm-svn: 132975
* Make __gnu_inline__ functions in gnu99 mode work the same way as inline ↵Eli Friedman2011-06-132-17/+25
| | | | | | | | functions in gnu89 mode in terms of redefinitions. rdar://9559708 . llvm-svn: 132953
* Handle overloaded operators in ?: precedence warningHans Wennborg2011-06-091-0/+13
| | | | | | | | | | | | | | This is a follow-up to r132565, and should address the rest of PR9969: Warn about cases such as int foo(A a, bool b) { return a + b ? 1 : 2; // user probably meant a + (b ? 1 : 2); } also when + is an overloaded operator call. llvm-svn: 132784
* Add isVCVT_N flag to identify Neon VCVT_N intrinsics, which require specialBob Wilson2011-06-091-1/+8
| | | | | | range checking for immediate operands. Radar 9558930. llvm-svn: 132783
* Second try at fixing this test, this time without breaking 32-bit Darwin ↵Eli Friedman2011-06-061-1/+1
| | | | | | builders. llvm-svn: 132694
* Start fixing up clang tests to work on the clang-native-arm-cortex-a9 builder.Eli Friedman2011-06-063-3/+5
| | | | llvm-svn: 132691
* Warn about missing parentheses for conditional operator.Hans Wennborg2011-06-032-1/+41
| | | | | | | | | | Warn in cases such as "x + someCondition ? 42 : 0;", where the condition expression looks arithmetic, and has a right-hand side that looks boolean. This (partly) addresses http://llvm.org/bugs/show_bug.cgi?id=9969 llvm-svn: 132565
* Rename -Wunknown-attributes to -Wattributes to match GCC.Ted Kremenek2011-06-011-1/+1
| | | | llvm-svn: 132422
* Expand the coverage of the warning for constants on the RHS of logical operands:Chandler Carruth2011-05-311-0/+18
| | | | | | | | | | | | return f() || -1; where the user meant to write '|'. This bootstraps without any additional warnings. Patch by Richard Trieu. llvm-svn: 132327
* Add a Microsoft C test following r131201.Francois Pichet2011-05-111-0/+8
| | | | llvm-svn: 131202
* Use a heralded conversion to bool in inline-asm constraints.John McCall2011-05-101-0/+8
| | | | llvm-svn: 131170
* Fix crash in -Wuninitialized when using switch statments whose condition is ↵Ted Kremenek2011-05-101-0/+13
| | | | | | a logical operation. llvm-svn: 131158
OpenPOWER on IntegriCloud