summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor the application of type attributes so that attributes fromJohn McCall2011-01-051-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | the declaration-specifiers and on the declarator itself are moved to the appropriate declarator chunk. This permits a greatly simplified model for how to apply these attributes, as well as allowing a much more efficient query for the GC attribute. Now all qualifier queries follow the same basic strategy of "local qualifiers, local qualifiers on the canonical type, then look through arrays". This can be easily optimized by changing the canonical qualified-array-type representation. Do not process type attributes as decl attributes on declarations with declarators. When computing the type of a block, synthesize a prototype function declarator chunk if the decl-spec type was not a function. This simplifies the logic for building block signatures. Change the logic which inserts an objc_read_weak on a block literal to only fire if the block has a __weak __block variable, rather than if the return type of the block is __weak qualified, which is not actually a sensible thing to ask. llvm-svn: 122871
* Prefer getAs<ComplexType> rather than cast<ComplexType> on canonical type. ↵Abramo Bagnara2011-01-041-11/+10
| | | | | | Suggestion by Douglas Gregor! llvm-svn: 122807
* Implement -Wself-assign, which warns on code such as:Chandler Carruth2011-01-041-0/+36
| | | | | | | | | | | | | | | | int x = 42; x = x; // Warns here. The warning avoids macro expansions, templates, user-defined assignment operators, and volatile types, so false positives are expected to be low. The common (mis-)use of this code pattern is to silence unused variable warnings, but a more idiomatic way of doing that is '(void)x;'. A follow-up to this will add a note and fix-it hint suggesting this replacement in cases where the StmtExpr consists precisely of the self assignment. llvm-svn: 122804
* Guard lazy synthesis of provisional ivars under the newFariborz Jahanian2011-01-031-2/+4
| | | | | | -fobjc-default-synthesize-properties flag. llvm-svn: 122757
* Unkown -> UnknownPeter Collingbourne2011-01-021-3/+3
| | | | llvm-svn: 122708
* Canonicalize types before possible cast.Abramo Bagnara2010-12-281-1/+2
| | | | llvm-svn: 122592
* Complain on missing property getter method onlyFariborz Jahanian2010-12-221-2/+9
| | | | | | | if property-dot expression is decidedly an rvalue. // rdar://8155806. llvm-svn: 122430
* Warn when message is sent to receiver ofFariborz Jahanian2010-12-211-6/+12
| | | | | | | | unknown type and there is a possibility that at runtime method is resolved to a deprecated or unavailable method. Addreses // rdar://8769853 llvm-svn: 122294
* Do lvalue-to-rvalue conversions on the LHS of a shift operator.John McCall2010-12-161-8/+8
| | | | | | Fixes rdar://problem/8776586. llvm-svn: 121992
* ivars craeted for explicit @synthesize and thoseFariborz Jahanian2010-12-151-1/+1
| | | | | | | created for auto-synthesis are @private. Fixes: // rdar://8769582 llvm-svn: 121913
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-6/+3
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Reorganize LookupMemberExpr for clarity and to make the obvious fast pathsJohn McCall2010-12-151-267/+321
| | | | | | come first. llvm-svn: 121866
* Sundry missing lvalue-to-rvalue conversions. Also leave a TODO for the vitalJohn McCall2010-12-151-7/+9
| | | | | | | future task of performing contextual conversion to size_t in a VLA size expression. :) llvm-svn: 121836
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-151-10/+2
| | | | | | | | | | | | | | | | | | whether the expression contains an unexpanded parameter pack, in the same vein as the changes to the Type hierarchy. Compute this bit within all of the Expr subclasses. This change required a bunch of reshuffling of dependency calculations, mainly to consolidate them inside the constructors and to fuse multiple loops that iterate over arguments to determine type dependence, value dependence, and (now) containment of unexpanded parameter packs. Again, testing is painfully sparse, because all of the diagnostics will change and it is more important to test the to-be-written visitor that collects unexpanded parameter packs. llvm-svn: 121831
* Added missing IgnoreParens().Abramo Bagnara2010-12-141-2/+3
| | | | llvm-svn: 121795
* Rewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fixJohn McCall2010-12-141-4/+18
| | | | | | | the basic casting logic to insert intermediate casts and preserve the exact complex-cast design. Fixes a crash in the test suite. llvm-svn: 121776
* Restore r121752 without modification.John McCall2010-12-141-12/+10
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-10/+12
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-12/+10
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-101-10/+10
| | | | | | | | | | space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. llvm-svn: 121478
* Bind the result of a property fetch to a temporary.John McCall2010-12-101-0/+4
| | | | llvm-svn: 121452
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-29/+0
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-1/+1
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121121
* Use Sema::MaybeCreateExprWithCleanups() only after we've checked for a ↵Douglas Gregor2010-12-071-1/+1
| | | | | | NULL/invalid expression llvm-svn: 121081
* Split out a function to do lvalue conversion on objects; this is basicallyJohn McCall2010-12-061-42/+51
| | | | | | | | | | FunctionArrayLvalueConversion but without the function/array decay. Generally this is only appropriate for use sites that know the type of the expression and thus that it can't be subject to the decays. Also make sure we do lvalue-to-rvalue on the bases of ivar references. llvm-svn: 121035
* Do unary conversions on vararg arguments and *then* special-case float.John McCall2010-12-061-4/+3
| | | | | | Fixes PR8742. llvm-svn: 121022
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Clarify the logic for when to build an overloaded binop. In particular,John McCall2010-12-061-17/+27
| | | | | | | | | build one when either of the operands calls itself type-dependent; previously we were building when one of the operand types was dependent, which is not always the same thing and which can lead to unfortunate inconsistencies later. Fixes PR8739. llvm-svn: 120990
* First pass at implementing the intent of ANSI C DR106.John McCall2010-12-041-0/+7
| | | | llvm-svn: 120904
* When deciding whether to complain about the type of a boolean condition, useJohn McCall2010-12-041-2/+2
| | | | | | the type of the expression *after* array/function decay. llvm-svn: 120895
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-50/+113
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Implement -cl-single-precision-constantPeter Collingbourne2010-12-041-0/+3
| | | | llvm-svn: 120877
* Diagnose when accessing property in a class method andFariborz Jahanian2010-12-031-2/+3
| | | | | | | no property accessor class method to be found, instead of crashing in IRGen. // rdar://8703553 llvm-svn: 120855
* Fixed typo.Abramo Bagnara2010-12-031-1/+1
| | | | llvm-svn: 120839
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-30/+26
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Swap order of checking for compatible vector types.Bob Wilson2010-12-021-7/+7
| | | | | | | | Check for compatible gcc, Altivec and Neon vectors before handling the lax-vector-conversions case. Otherwise there is no way to avoid the warnings from -Wvector-conversions. llvm-svn: 120633
* Restore the lvalue-to-rvalue conversion patch with a minimal fix.John McCall2010-12-011-37/+50
| | | | llvm-svn: 120555
* L-value to r-value conversion is not ready for prime-time.John McCall2010-11-301-50/+37
| | | | llvm-svn: 120433
* Such function decls,as objc's objc_msgSend, builtins in Fariborz Jahanian2010-11-301-7/+2
| | | | | | | | | a specific language. We are adding such language info. by extensing Builtins.def and via a language flag added to LIBBUILTIN/BUILTIN and check for that when deciding a name is builtin or not. Implements //rdar://8689273. llvm-svn: 120429
* Introduce an r-value to l-value cast kind. I'm not promising anythingJohn McCall2010-11-301-37/+50
| | | | | | about the reliability of this yet. llvm-svn: 120422
* Fix bug in r120299 spotted by dgregor.Nico Weber2010-11-301-3/+3
| | | | llvm-svn: 120389
* Always use a function's decl context when building default arguments. Fixes ↵Nico Weber2010-11-291-4/+12
| | | | | | http://http://llvm.org/pr8479. llvm-svn: 120299
* Revert parts of r120266 that I did not mean to commitNico Weber2010-11-281-12/+4
| | | | llvm-svn: 120267
* Minor whitespace and comment fixes. No functionality change.Nico Weber2010-11-281-4/+12
| | | | llvm-svn: 120266
* Allow access to non-static members without an object in sizeof expressions, ↵Sebastian Redl2010-11-261-2/+22
| | | | | | in C++0x. Patch by Jakub Wieczorek. llvm-svn: 120182
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-14/+15
| | | | llvm-svn: 120084
* A few tweaks to the value-kind computation:John McCall2010-11-231-70/+79
| | | | | | | | | | | | | - Default argument expressions pick up the value kind of the incoming expression, not the value kind of the parameter it initializes. - When building a template argument for substitution, A::x is an rvalue if x is an instance method. - Anonymous struct/union paths pick up value kind the same way that normal member accesses do; extract out a common code path for this. Enable the value-kind assertion, now that it passes self-host. llvm-svn: 120055
* Fix a bunch of IndirectFieldDecl-related warnings.Benjamin Kramer2010-11-211-1/+1
| | | | | | - Negative ChainingSize doesn't make sense, make it unsigned. llvm-svn: 119943
* Major anonymous union/struct redesign.Francois Pichet2010-11-211-93/+52
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* objc_msgSend is not a builtin type in non-objc mode.Fariborz Jahanian2010-11-191-2/+7
| | | | | | Fixes //rdar://8686888 llvm-svn: 119813
OpenPOWER on IntegriCloud