summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Update ImplicitCastExpr to be able to represent an XValue.Sebastian Redl2010-07-201-6/+5
| | | | llvm-svn: 108807
* Categories cannot synthesize property ivars,Fariborz Jahanian2010-07-191-5/+5
| | | | | | and a minor cleanup. llvm-svn: 108707
* Check for casts to an incomplete type in C. Improves diagnostics for cast toEli Friedman2010-07-171-0/+4
| | | | | | | incomplete union (PR5692) and incomplete enum, and fixes obscure accepts-invalid on cast to incomplete struct. llvm-svn: 108630
* Patch to synthesize property ivars on demand asFariborz Jahanian2010-07-171-0/+38
| | | | | | | part of the new property synthesis by default. wip. llvm-svn: 108599
* restrict the && -> & warning to cover a case daniel noted.Chris Lattner2010-07-151-0/+4
| | | | | | | Don't warn about "logically bool" expressions on the RHS, even if they fold to a constant. llvm-svn: 108388
* Consider obective-c pointer arguments as valid sentinel argsFariborz Jahanian2010-07-141-1/+1
| | | | | | as well. Fixes radar 7975788. llvm-svn: 108333
* Add a warning to catch a bug recently caught by code review, like this:Chris Lattner2010-07-131-2/+16
| | | | | | | | | | | t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wlogical-bitwise-confusion] return x && 4; ^ ~ wording improvement suggestions are welcome. llvm-svn: 108260
* Whenever we're creating an expression that is typically an rvalueDouglas Gregor2010-07-131-3/+6
| | | | | | | | | | | | | | | | (e.g., a call, cast, etc.), immediately adjust the expression's type to strip cv-qualifiers off of all non-class types (in C++) or all types (in C). This effectively extends my previous fix for PR7463, which was restricted to calls, to other kinds of expressions within similar characteristics. I've audited every use of getNonReferenceType() in the code base, switching to the newly-renamed getNonLValueExprType() where necessary. Big thanks to Eli for pointing out just how incomplete my original fix for PR7463 actually was. We've been handling cv-qualifiers on rvalues wrong for a very, very long time. Fixes PR7463. llvm-svn: 108253
* When forming a function call or message send expression, be sure toDouglas Gregor2010-07-131-4/+4
| | | | | | | | | | | | | | | | | strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
* Compute Type dependent-ness of BlockDeclRefExprFariborz Jahanian2010-07-121-2/+1
| | | | | | on the fly when constructing it. llvm-svn: 108166
* Move setting of Dependent Type to BlockDeclRefExpr'sFariborz Jahanian2010-07-121-4/+3
| | | | | | constructor. llvm-svn: 108157
* Fix another aspect of PR7047, macro expansions. Previously, this was hackedChandler Carruth2010-07-121-7/+8
| | | | | | | | | | | | around by exempting enums from the check, but this doesn't handle a lot of cases. A better approach is to directly check if the operator comes from a macro expansion. I've removed a reference to the rdar that originally led to the enum suppression when removing it's overly contrived test case. Let me know if that number or a more reasilistic test case involving enums is still needed. llvm-svn: 108128
* Lay the ground work for resoving PR7047. This doesn't actually fix it becauseChandler Carruth2010-07-101-3/+18
| | | | | | | | | | default arguments to template parameters don't have a DeclContext when instantiated, and so we can't detect that we're in an instantiation context as opposed to the definition context. However, it fixes the more commonly-occuring cases in TMP code that use devolve to this type of tautology after substitution. llvm-svn: 108044
* BlockDeclRefExpr of a dependent type mustFariborz Jahanian2010-07-091-13/+16
| | | | | | be a dependent expression when its is built. llvm-svn: 108026
* Instantiation of block literal expressions. wip.Fariborz Jahanian2010-07-091-2/+5
| | | | llvm-svn: 108000
* When performing substitution of template arguments within the body ofDouglas Gregor2010-07-081-3/+4
| | | | | | | a template, be sure to include the template arguments from the injected-class-name. Fixes PR7587. llvm-svn: 107895
* Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis2010-07-071-1/+1
| | | | | | | | of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". llvm-svn: 107768
* implement PR7569, warning about assignment to null, which Chris Lattner2010-07-071-0/+17
| | | | | | | | people seem to write when they want a deterministic trap. Suggest instead that they use a volatile pointer or __builtin_trap. llvm-svn: 107756
* Fix multiple emission of the this-> fixit for each instantiation by fixing theNick Lewycky2010-07-061-5/+23
| | | | | | AST during the instantiation. Fixes PR7417! llvm-svn: 107690
* fix a bug I introduced in r107624Chris Lattner2010-07-051-5/+2
| | | | llvm-svn: 107626
* rearrange some logic, no functionality change.Chris Lattner2010-07-051-19/+30
| | | | llvm-svn: 107624
* Fix vector literal/cast confusion - bug 6895.John Thompson2010-06-301-2/+13
| | | | llvm-svn: 107347
* Fix rdar://8139785 "implement warning on dead expression in comma operator"Argyrios Kyrtzidis2010-06-301-0/+2
| | | | | | | | | | As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g: x || test_logical_foo1(); emitted a bogus "expression result unused" for 'x'. llvm-svn: 107274
* When typo correction produces a result that is not of the kind we'reDouglas Gregor2010-06-291-0/+4
| | | | | | | looking for, reset the name within the LookupResult structure in addition to clearing out the results. Fixes PR7508. llvm-svn: 107197
* Vector types are not arithmetic types, either. Note that we now banDouglas Gregor2010-06-221-2/+3
| | | | | | | | | __real myvec and __imag myvec, since they aren't all that useful (it's just an identity function) but we might want to use them in more restricted cases in the future (e.g., "__real mycomplexvec" could extract the real parts of a vector of complex numbers). llvm-svn: 106601
* Change Type::isFloatingType() to reflect the actual definition of aDouglas Gregor2010-06-221-6/+6
| | | | | | | | | | | "floating type" in C, which does not include vector types. Introduce Type::hasFloatingRepresentation() for the places where we want to know whether the underlying representation is one or more floating-point values. Remove some hacks we had where the former behavior of Type::isFloatingType() was at odds with the language definition of the term. llvm-svn: 106584
* Zero out a stale pointerDouglas Gregor2010-06-211-0/+1
| | | | llvm-svn: 106497
* Given Decl::isUsed() a flag indicating when to consider the "used"Douglas Gregor2010-06-171-5/+5
| | | | | | | | | attribute as part of the calculation. Sema::MarkDeclReferenced(), and a few other places, want only to consider the "used" bit to determine, e.g, whether to perform template instantiation. Fixes a linkage issue with Boost.Serialization. llvm-svn: 106252
* Do not treat @selector as lvalue (unlike g++).Fariborz Jahanian2010-06-171-0/+2
| | | | | | Patch by Nico Weber (pr7390). llvm-svn: 106242
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-60/+30
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* Give Type::isIntegralType() an ASTContext parameter, so that itDouglas Gregor2010-06-161-3/+3
| | | | | | | | | | | | provides C "integer type" semantics in C and C++ "integral type" semantics in C++. Note that I still need to update isIntegerType (and possibly other predicates) using the same approach I've taken for isIntegralType(). The two should have the same meaning, but currently don't (!). llvm-svn: 106074
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-1/+2
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* Update equality and relationship comparisons of pointers to reflectDouglas Gregor2010-06-151-26/+30
| | | | | | | | | C++ semantics, eliminating an extension diagnostic that doesn't match C++ semantics (ordered comparison with NULL) and tightening some extwarns to errors in C++ to match GCC and maintain conformance in SFINAE contexts. Fixes <rdar://problem/7941392>. llvm-svn: 106050
* tidy upChris Lattner2010-06-151-1/+1
| | | | llvm-svn: 106011
* Another chunk of the new RecursiveASTVisitor implementation: switch the returnChandler Carruth2010-06-101-1/+1
| | | | | | | value semantics such that we recurse while the visitors return true, and halt as soon as one returns false. Patch by csilvers. llvm-svn: 105787
* Major redesign of the RecursiveASTVisitor. This implements the majority of theChandler Carruth2010-06-091-14/+15
| | | | | | | | | | new design discussed on cfe-dev, with further steps in that direction to come. It is already much more complete than the previous visitor. Patch by Zhanyong and Craig with 80 column wraps and one missing declaration added by me. llvm-svn: 105709
* Warn about comparisons between arrays and improve self-comparisonDouglas Gregor2010-06-081-11/+45
| | | | | | warnings, from Troy Straszheim! Fixes PR6163. llvm-svn: 105631
* Fixes a typo which prevented proper code gen. forFariborz Jahanian2010-06-081-2/+1
| | | | | | copy-in of c++ class objects into blocks. llvm-svn: 105622
* When using property-dot assignment syntax to call a setter method,Fariborz Jahanian2010-06-071-2/+13
| | | | | | | type of rhs need be compared to setter's argument and not the getter type. Fixes radar 8062778 llvm-svn: 105560
* Use MaybeCreateCXXExprWithTemporaries for potential destruction ofFariborz Jahanian2010-06-071-2/+3
| | | | | | | created temporary. Use own initialized entity for copied in block variables. llvm-svn: 105533
* Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.John McCall2010-06-041-2/+2
| | | | | | This is never null, but the associated type might be. llvm-svn: 105503
* Build AST for copy-construction of copied-inFariborz Jahanian2010-06-041-2/+22
| | | | | | class object in blocks and carry it to IRGen. llvm-svn: 105487
* Preserve more information from a block's original function declarator, if oneJohn McCall2010-06-041-26/+58
| | | | | | | was given. Remove some unnecessary accounting from BlockScopeInfo. Handle typedef'ed function types until such time as we decide not. llvm-svn: 105478
* Restructure how we interpret block-literal declarators. Correctly handleJohn McCall2010-06-041-71/+63
| | | | | | | the case where we pick up block arguments from a typedef. Save the block signature as it was written, and preserve same through PCH. llvm-svn: 105466
* Remove a couple of unnecessary uses of IsStandardConversion.John McCall2010-06-041-17/+6
| | | | llvm-svn: 105445
* Fix unintentional method call due to false -> pointer conversion; patch by ↵Daniel Dunbar2010-06-021-1/+1
| | | | | | Dimitry Andric! llvm-svn: 105327
* In C++, one cannot assign from an arithmetic type to an enumerationDouglas Gregor2010-05-231-1/+2
| | | | | | type. Fixes PR7051. llvm-svn: 104475
* Complain about sizeof(overloaded function) rather than crashing.Douglas Gregor2010-05-231-0/+6
| | | | llvm-svn: 104470
* Provide the overloaded functions for UnresolvedLookupExpr andDouglas Gregor2010-05-231-4/+3
| | | | | | | UnresolvedMemberExpr in their constructors, rather than adding them after the fact. No functionality change. llvm-svn: 104468
* Improve our handling of reference binding for subobjects ofDouglas Gregor2010-05-221-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | temporaries. There are actually several interrelated fixes here: - When converting an object to a base class, it's only an lvalue cast when the original object was an lvalue and we aren't casting pointer-to-derived to pointer-to-base. Previously, we were misclassifying derived-to-base casts of class rvalues as lvalues, causing various oddities (including problems with reference binding not extending the lifetimes of some temporaries). - Teach the code for emitting a reference binding how to look through no-op casts and parentheses directly, since Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make sure that we properly look through multiple levels of indirection from the temporary object, but destroy the actual temporary object; this fixes the reference-binding issue mentioned above. - Teach Objective-C message sends to bind the result as a temporary when needed. This is actually John's change, but it triggered the reference-binding problem above, so it's included here. Now John can actually test his return-slot improvements. llvm-svn: 104434
OpenPOWER on IntegriCloud