summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.Richard Smith2011-10-181-11/+12
| | | | llvm-svn: 142419
* Make it possible to compute the type of 'this' without capturingDouglas Gregor2011-10-181-6/+8
| | | | | | it. Refactoring to be used in a moment. llvm-svn: 142360
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-0/+6
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* Teach __has_nothrow_assign not to complain about access (GCC and EDGDouglas Gregor2011-10-121-1/+5
| | | | | | | ignore access entirely for it) and not to crash on assignment operator templates. Fixes PR11110. llvm-svn: 141777
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-0/+6
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* When performing a user-defined conversion via a constructor, be sureDouglas Gregor2011-10-101-6/+10
| | | | | | | to check whether the constructor is accessible. Fixes <rdar://problem/10202900>. llvm-svn: 141588
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-4/+17
| | | | llvm-svn: 141171
* Refactor the analysis of C++ cast expressions so that evenJohn McCall2011-10-051-19/+2
| | | | | | | | C-style and functional casts are built in SemaCXXCast.cpp. Introduce a helper class to encapsulate most of the random state being passed around, at least one level down. llvm-svn: 141170
* Get rid of useless helper Sema::CastCategory.Eli Friedman2011-09-271-6/+5
| | | | llvm-svn: 140642
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-6/+0
| | | | llvm-svn: 140407
* Add a new warning to -Wliteral-conversion to catch cases where a string literalRichard Trieu2011-09-231-1/+1
| | | | | | | | | | | | | | is cast to a boolean. An exception has been made for string literals in logical expressions to allow the common case of use in assert statements. bool x; x = "hi"; // Warn here void foo(bool x); foo("hi"); // Warn here assert(0 && "error"); assert("error); // Warn here llvm-svn: 140405
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-7/+7
| | | | llvm-svn: 140367
* ArrayRef-ifying Function/BlockDecl's setParamsDavid Blaikie2011-09-211-1/+1
| | | | llvm-svn: 140268
* Enforce access control for conversion operators used in contextualJohn McCall2011-09-211-1/+3
| | | | | | conversions (rather than just call-arguments). llvm-svn: 140244
* Finish the lex->LHS and rex->RHS cleanup in Sema.Richard Trieu2011-09-151-27/+28
| | | | llvm-svn: 139856
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-2/+2
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-0/+9
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Code formatting; no functionality change.John McCall2011-09-091-9/+9
| | | | llvm-svn: 139355
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Perform array bounds checking in more situations and properly handle specialKaelyn Uhrain2011-08-051-3/+0
| | | | | | | | | | | | | | | | case situations with the unary operators & and *. Also extend the array bounds checking to work with pointer arithmetic; the pointer arithemtic checking can be turned on using -Warray-bounds-pointer-arithmetic. The changes to where CheckArrayAccess gets called is based on some trial & error and a bunch of digging through source code and gdb backtraces in order to have the check performed under as many situations as possible (such as for variable initializers, arguments to function calls, and within conditional in addition to the simpler cases of the operands to binary and unary operator) while not being called--and triggering warnings--more than once for a given ArraySubscriptExpr. llvm-svn: 136997
* In ARC, don't try to reclaim the result of a call to performSelectorJohn McCall2011-08-031-5/+8
| | | | | | unless done in a context where the value is used retained. llvm-svn: 136769
* Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().Anna Zaks2011-07-281-2/+2
| | | | llvm-svn: 136379
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-6/+14
| | | | llvm-svn: 136210
* Re-fix r136172 so it isn't an error; apparently, some people are fond of ↵Eli Friedman2011-07-261-16/+13
| | | | | | their undefined behavior. llvm-svn: 136183
* Diagnose trying to delete a pointer to an abstract class with a non-virtual ↵Eli Friedman2011-07-261-1/+13
| | | | | | | | destructor. PR10504. I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :) llvm-svn: 136172
* A couple minor issues with Sema for delete:Eli Friedman2011-07-261-22/+28
| | | | | | | | | 1. Attempting to delete an expression of incomplete class type should be an error, not a warning. 2. If someone tries to delete a pointer to an incomplete class type, make sure we actually emit the delete expression after we warn. llvm-svn: 136161
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-10/+10
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Enforce access control for the destructor in a new[] expression and markJohn McCall2011-07-131-1/+11
| | | | | | | it as used. Otherwise, we can fail to instantiate or validate the destructor, which can lead to crashes in IR gen like PR10351. llvm-svn: 135073
* objc++-arc: more diagnosis of converting a weak-unavailableFariborz Jahanian2011-07-081-2/+14
| | | | | | object to a __weak object type. // rdar://9732636 llvm-svn: 134706
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-7/+6
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Properly implement the scope restriction on the NRVO forDouglas Gregor2011-07-061-10/+64
| | | | | | | | | | | | throw-expressions, such that we don't consider the NRVO when the non-volatile automatic object comes from outside the innermost try scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were incorrect but it didn't matter because IR generation doesn't actually apply the NRVO here. In C++0x, however, we were moving from an object when in fact we should have copied from it. Fixes PR10142 / <rdar://problem/9714312>. llvm-svn: 134548
* Perform lvalue-to-rvalue conversions on both operands of ->*John McCall2011-06-301-0/+14
| | | | | | and the RHS of .*. Noticed by Enea Zaffanella! llvm-svn: 134170
* Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameterArgyrios Kyrtzidis2011-06-281-2/+1
| | | | | | from Sema::GetTypeForDeclarator. No functionality change. llvm-svn: 133987
* Centralize all checks for a C++ tag definition inside a typename inArgyrios Kyrtzidis2011-06-281-1/+1
| | | | | | | | Sema::GetTypeForDeclarator and remove its 'OwnedDecl' out parameter. No functionality change. llvm-svn: 133986
* Fix PR10204 in a better way.John McCall2011-06-271-1/+10
| | | | llvm-svn: 133943
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-1/+1
| | | | | | | | '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-1/+1
| | | | | | | | 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
* Automatic Reference Counting.John McCall2011-06-151-70/+238
| | | | | | | | | | 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
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-30/+43
| | | | llvm-svn: 132878
* Fix order of operands for the warning about incompatible Objective-CDouglas Gregor2011-06-111-1/+1
| | | | | | | pointer assignment in C++. This was a longstanding problem spotted by Jordy Rose. llvm-svn: 132873
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Fix a bunch more notes that were emitted even when the diagnostic theyChandler Carruth2011-06-081-6/+9
| | | | | | were intended for was suppressed. llvm-svn: 132746
* Remove all references to InitializationSequence::FailedSequence from outside ↵Sebastian Redl2011-06-051-3/+3
| | | | | | SemaInit.cpp. Replace them with the boolean conversion or the new Failed() function. This is a first step towards removing InitializationSequence::SequenceKind. No functionality change. llvm-svn: 132664
* Add new warning that warns when invoking 'delete' on a polymorphic, ↵Argyrios Kyrtzidis2011-05-241-0/+14
| | | | | | | | non-final, class without a virtual destructor. Patch by Matthieu Monrocq! llvm-svn: 131989
* The array-size operand to a new-expression is not necessarily a size_t.John McCall2011-05-151-2/+2
| | | | | | | It can be larger, it can be smaller, it can be signed, whatever. Handle all the crazy cases with grace and spirit. llvm-svn: 131378
* Implement the __is_trivially_copyable type traitAlexis Hunt2011-05-131-0/+3
| | | | llvm-svn: 131270
* Implement defaulting of destructors.Alexis Hunt2011-05-121-23/+39
| | | | llvm-svn: 131260
* HrmAlexis Hunt2011-05-121-18/+21
| | | | llvm-svn: 131259
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-4/+4
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* Look at all the record redeclaration when looking for a uuid attribute.Francois Pichet2011-05-081-4/+5
| | | | llvm-svn: 131066
OpenPOWER on IntegriCloud