summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* When complaining about a non-POD second argument to va_arg, use aDouglas Gregor2011-07-301-2/+5
| | | | | | | | special diagnostic for ARC ownership-qualified types. We wouldn't want to expose Objective-C programmers to the term "POD", would we? Fixes <rdar://problem/9772982>. llvm-svn: 136558
* Fix an inconsistency in Sema::ConvertArgumentsForCall in thatPeter Collingbourne2011-07-291-5/+12
| | | | | | | the callee note diagnostic was not emitted in the case where there were too few arguments. llvm-svn: 136437
* Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().Anna Zaks2011-07-281-2/+30
| | | | llvm-svn: 136379
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-7/+32
| | | | llvm-svn: 136210
* Revert r136046 while fixing handling of e.g. &foo[index_one_past_size]Kaelyn Uhrain2011-07-261-17/+0
| | | | llvm-svn: 136113
* Expand array bounds checking to work in the presence of unary & and *,Kaelyn Uhrain2011-07-261-0/+17
| | | | | | | | | and to work with pointer arithmetic in addition to array indexing. The new pointer arithmetic porition of the array bounds checking can be turned on by -Warray-bounds-pointer-arithmetic (and is off by default). llvm-svn: 136046
* Test commitKaelyn Uhrain2011-07-261-1/+0
| | | | llvm-svn: 136044
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-13/+13
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* This handles the missing cases of opencl vector literals.Tanya Lattner2011-07-151-5/+18
| | | | | | Test cases provided by Anton Lokhmot. llvm-svn: 135322
* Remove warnings of constant operands of logical operators from template ↵Richard Trieu2011-07-151-2/+2
| | | | | | | | | | | | | | instantiations. Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like: template<unsigned int A, unsigned int B> struct S { int foo() { int x = A && B; } } will not warn on A && B on every instantiation. This will still warn on other cases inside templates, which will be caught on checking the template definition. llvm-svn: 135222
* In debugger mode, make ObjC message sends to unknown selectors returnJohn McCall2011-07-131-5/+5
| | | | | | | | | | __unknown_anytype, and rewrite such message sends correctly. I had to bite the bullet and actually add a debugger support mode for this one, which is a bit unfortunate, but there really isn't anything else I could imagine doing; this is clearly just debugger-specific behavior. llvm-svn: 135051
* Fix a bug where a local variable named 'self' is causingFariborz Jahanian2011-07-121-22/+4
| | | | | | | implicit ivar accesses to go through the 'self' variable rather than the real 'self' for the method. // rdar://9730771 llvm-svn: 134992
* Pop block scope after reading from it.Benjamin Kramer2011-07-121-4/+4
| | | | | | Found by valgrind. llvm-svn: 134983
* Fix typo correction crash on overloaded functions, pr10283.Hans Wennborg2011-07-121-2/+1
| | | | | | | It would be cool if we could do overload resolution to suggest the right function, but at least this fixes the crashing. llvm-svn: 134976
* Add diagnostic for constructs like "va_arg(l, float)" which have undefined ↵Eli Friedman2011-07-111-0/+17
| | | | | | behavior. PR10201. llvm-svn: 134926
* objc-arc: Diagnose when captured variable in block literalsFariborz Jahanian2011-07-111-0/+9
| | | | | | | | require destruction and there is possibility of that without construction. Thanks Johnm for review and suggestions offline. // rdar://9535237. llvm-svn: 134906
* objc++-arc: more diagnosis of converting a weak-unavailableFariborz Jahanian2011-07-081-1/+1
| | | | | | object to a __weak object type. // rdar://9732636 llvm-svn: 134706
* objc++-arc: diagnose assignment/cast of a weak-unavailableFariborz Jahanian2011-07-071-21/+11
| | | | | | | object to a __weak object/type. // rdar://9732636. One item is yet todo. llvm-svn: 134655
* objc-arc: diagnose assignment/cast of a weak-unavailableFariborz Jahanian2011-07-071-1/+32
| | | | | | | object to a __weak object/type. // rdar://9732636. This is objc side of things. objc++ side tbd. llvm-svn: 134624
* [ARC] When casting from a pointer to an objective-c object with known ↵Argyrios Kyrtzidis2011-07-011-6/+14
| | | | | | | | | | | | ownership, if the cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type to the cast type: id x; (NSString**)&x; // Casting as (__strong NSString**). llvm-svn: 134275
* -Remove Sema::ActOnCastOfParenListExpr and move most of its functionality toArgyrios Kyrtzidis2011-07-011-79/+95
| | | | | | | | | newly introduced Sema::BuildVectorLiteral. -Make Sema::ActOnCastExpr handle a vector initializer both when the cast'ed expression is a ParenListExpr and when it is a ParenExpr. -Ultimately make Sema::ActOnParenOrParenListExpr independent of what the cast type was. llvm-svn: 134274
* Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor2011-06-281-18/+23
| | | | | | | | | | | | | | | vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
* Cleanup a fixme by using a specific diagnostic for subscriptingChandler Carruth2011-06-271-3/+2
| | | | | | a pointer to void. llvm-svn: 133912
* Factor out (some of) the checking for invalid forms of pointerChandler Carruth2011-06-271-126/+151
| | | | | | | | | | | | | | | | | | | 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
* objc-arc: Check on a variety of unsafe assignment of retained Fariborz Jahanian2011-06-241-2/+2
| | | | | | objects. // rdar://9495837 llvm-svn: 133806
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-2/+2
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Fix Sema::CheckVectorOperands so that it doesn't try to insert a cast ↵Eli Friedman2011-06-231-36/+29
| | | | | | | | 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
* Move all of Sema's member-access-related checking out of SemaExpr.cppDouglas Gregor2011-06-231-1587/+11
| | | | | | | | | and into a new file, SemaExprMember.cpp, bringing SemaExpr.cpp just under 10,000 lines of code (ugh). No functionality change, although I intend to do some refactoring of this code to address PR8368 at some point in the "near" future. llvm-svn: 133674
* Check for placeholders early on inDouglas Gregor2011-06-221-4/+6
| | | | | | | Sema::CreateUnaryExprOrTypeTraitExpr() rather than recursing in some cases. Fixes <rdar://problem/9659191>. llvm-svn: 133663
* Changes ParenListExpr to always require a type.Manuel Klimek2011-06-221-1/+2
| | | | | | | Removes dead code found in the process. Adds a test to verify that ParenListExprs do not have NULL types. llvm-svn: 133637
* Fix the starting location of the Fix-It note for suspicious precedenceDouglas Gregor2011-06-221-1/+2
| | | | | | | issues between a bitwise operator and a comparison operator. Fixes <rdar://problem/9637759>. llvm-svn: 133630
* Revert r133526 which re-orders the suggestions for -Wparentheses on ?:Chandler Carruth2011-06-211-4/+4
| | | | | | | operators. There is a consistent design of having the "silence the warning" option first. llvm-svn: 133570
* Switch the order of the notes for the parentheses suggested in the caseChandler Carruth2011-06-211-4/+4
| | | | | | | | of: a + b ? x : y. In our testing of this flag we've yet to hit a single case where the existing precedence was correct, so we should suggest grouping the ?: first. llvm-svn: 133526
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-1/+0
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.Argyrios Kyrtzidis2011-06-201-1/+30
| | | | | | 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-2/+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
* Move away from the poor "abstraction" I added to Type. John arguedChandler Carruth2011-06-201-24/+32
| | | | | | | | | | | | | | effectively that this abstraction simply doesn't exist. That is highlighted by the fact that by using it we were papering over a more serious error in this warning: the fact that we warned for *invalid* constructs involving member pointers and block pointers. I've fixed the obvious issues with the warning here, but this is confirming an original suspicion that this warning's implementation is flawed. I'm looking into how we can implement this more reasonably. WIP on that front. llvm-svn: 133425
* Restructure the API in Type based on a conversation with Richard Smith.Chandler Carruth2011-06-201-1/+4
| | | | | | | | | | | This makes 'isPointerLikeType' a little less confusing, and pulls the decay check into a separate interface that is much more clear and concrete. Also, just implement these as logical wrappers around other predicates. Having a switch based implementation isn't likely to be necessary. We can try to optimize them later if they show up on a profile. llvm-svn: 133405
* Add test cases for false positives on -Wnull-arithmetic from RichardChandler Carruth2011-06-191-25/+8
| | | | | | | | | | | | | Trieu, and fix them by checking for array and function types as well as pointer types. I've added a predicate method on Type to bundle together the logic we're using here: isPointerLikeType(). I'd welcome better names for this predicate, this is the best I came up with. It's implemented as a switch to be a touch lighter weight than all the chained isa<...> casts that would result otherwise. llvm-svn: 133383
* Add a minor hack to avoid using isNullPointerConstant on a hot path. Fixes ↵Eli Friedman2011-06-171-6/+5
| | | | | | | | -O0 compile-time regressions from r133196. rdar://9629775 . llvm-svn: 133290
* Don't emit 'unavailable' errors inside an unavailable function. rdar://9623855.Argyrios Kyrtzidis2011-06-171-12/+14
| | | | llvm-svn: 133264
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-10/+13
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Implement proper support for generating code for compound literals inDouglas Gregor2011-06-171-2/+3
| | | | | | | | | | | | | C++, which means: - binding the temporary as needed in Sema, so that we generate the appropriate call to the destructor, and - emitting the compound literal into the appropriate location for the aggregate, rather than trying to emit it as a temporary and memcpy() it. Fixes PR10138 / <rdar://problem/9615901>. llvm-svn: 133235
* Check for placeholder expressions before promoting an argument passedDouglas Gregor2011-06-171-1/+5
| | | | | | through an ellipsis. Fixes <rdar://problem/9623945>. llvm-svn: 133219
* Add a new warning when a NULL constant is used in arithmetic operations. ↵Richard Trieu2011-06-161-0/+54
| | | | | | | | The warning will fire on cases such as: int x = 1 + NULL; llvm-svn: 133196
* Allow comparison between block pointers and NULL pointerDouglas Gregor2011-06-161-2/+4
| | | | | | constants. Fixes PR10145. llvm-svn: 133179
* arc: diagnose dereferencing a __weak pointer which may beFariborz Jahanian2011-06-161-0/+10
| | | | | | null at any time. // rdar://9612030 llvm-svn: 133168
* Refactor parentheses suggestion notes to have less code duplication andChandler Carruth2011-06-161-63/+36
| | | | | | | | | | be more consistent in how parenthesized ranges which hit macros are handled. Also makes the code significantly shorter, and the diagnostics when macros are present a bit more useful. Pair programmed w/ Matthew. llvm-svn: 133122
* Cleanup the parameter naming style.Chandler Carruth2011-06-161-8/+8
| | | | llvm-svn: 133120
* Automatic Reference Counting.John McCall2011-06-151-32/+197
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
OpenPOWER on IntegriCloud