summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add some code to accurately perform odr-used marking for variables per the ↵Eli Friedman2012-02-021-24/+98
| | | | | | C++11 rules. llvm-svn: 149641
* Pacify gcc's -Wreturn-typeMatt Beaumont-Gay2012-02-021-0/+1
| | | | llvm-svn: 149610
* Split Sema::MarkDeclarationReferenced into multiple functions; the ↵Eli Friedman2012-02-021-141/+181
| | | | | | additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch. llvm-svn: 149586
* Improve checking of explicit captures in a C++11 lambda expression:Douglas Gregor2012-02-011-2/+3
| | | | | | | | | | | | | | - Actually building the var -> capture mapping properly (there was an off-by-one error) - Keeping track of the source location of each capture - Minor QoI improvements, e.g, highlighing the prior capture if there are multiple captures, pointing at the variable declaration we found if we reject it. As part of this, add standard citations for the various semantic checks we perform, and note where we're not performing those checks as we should. llvm-svn: 149462
* Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain2012-01-311-1/+1
| | | | llvm-svn: 149451
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-17/+25
| | | | llvm-svn: 149127
* Refactor to share code for handling return statements between lambda ↵Eli Friedman2012-01-261-0/+3
| | | | | | expressions and block literals. As it turns out, almost all the logic can be shared. llvm-svn: 149031
* Avoid correcting unknown identifiers to types where types aren't allowed.Kaelyn Uhrain2012-01-251-2/+3
| | | | | | | | Pass a typo correction callback object from ParseCastExpr to Sema::ActOnIdExpression to be a bit more selective about what kinds of corrections will be allowed for unknown identifiers. llvm-svn: 148973
* objc: Issue a generic diagnostic assigning to Fariborz Jahanian2012-01-241-6/+1
| | | | | | an objc object in any abi mode. llvm-svn: 148847
* objc: issue error if assigning objects in fragile-abi too.Fariborz Jahanian2012-01-241-4/+8
| | | | | | // rdar://10731065 llvm-svn: 148823
* Rename Sema::isNullExpr() -> Sema::isSentinelNullExpr() which is more ↵Argyrios Kyrtzidis2012-01-241-2/+2
| | | | | | descriptive. llvm-svn: 148772
* Introduce Sema::isNullExpr() that contains the checks thatArgyrios Kyrtzidis2012-01-231-11/+19
| | | | | | Sema::DiagnoseSentinelCalls() does. llvm-svn: 148722
* Fix some comments relating to ExpressionEvaluationContexts. Get rid of a ↵Eli Friedman2012-01-211-11/+8
| | | | | | couple of uses of ConstantEvaluated which don't make sense. llvm-svn: 148624
* Add obvious missing call to MarkDeclarationReferenced.Eli Friedman2012-01-211-0/+1
| | | | llvm-svn: 148611
* Make clang's AST model sizeof and typeof with potentially-evaluated operands ↵Eli Friedman2012-01-211-0/+12
| | | | | | correctly, similar to what we already do with typeid. llvm-svn: 148610
* Localize variable, remove unused assignment.Benjamin Kramer2012-01-201-5/+1
| | | | | | Found by the clang static analyzer. llvm-svn: 148544
* Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler ↵Eli Friedman2012-01-201-86/+43
| | | | | | and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately. llvm-svn: 148522
* A few style changes.Tanya Lattner2012-01-191-6/+3
| | | | | | | Change CheckVectorLogicalOperands to pass params by ref. Add another test case. llvm-svn: 148452
* Fix char literal types in CSeth Cantrell2012-01-181-8/+6
| | | | | | | | L'x' is actually wchar_t support C11 u and U char literals llvm-svn: 148390
* Convert DiagnoseEmptyLookup to use correction callbacks.Kaelyn Uhrain2012-01-181-3/+4
| | | | | | | | | | | | No new unit tests yet as there is no behavioral change (except for slightly more specific filtering in Sema::ActOnStartOfLambdaDefinition). Tests will be added as the code paths are traced in greater depth to determine how to improve the results--there are at least one or two known bugs that require those improvements. This commit lays the groundwork for those changes. llvm-svn: 148382
* Fix a couple issues where we didn't correctly delay diagnostics in ↵Eli Friedman2012-01-181-4/+58
| | | | | | PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated. llvm-svn: 148367
* Correctly resolve an overload set passed to an overloaded operator=. PR11784.Eli Friedman2012-01-171-0/+3
| | | | llvm-svn: 148335
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-16/+8
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-1/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Revert r148271; this requires more thought.Eli Friedman2012-01-171-28/+11
| | | | llvm-svn: 148276
* Change the behavior of the lvalue-to-rvalue conversion for varargs in ↵Eli Friedman2012-01-171-11/+28
| | | | | | | | PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much. In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context. llvm-svn: 148271
* Add support for OpenCL 1.1 logical operations.Tanya Lattner2012-01-161-16/+44
| | | | llvm-svn: 148254
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-4/+45
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* Refactor variables unused under non-assert builds.David Blaikie2012-01-161-2/+1
| | | | llvm-svn: 148229
* Pedantic diagnostic correction: in C++, we have integral constant expressions,Richard Smith2012-01-151-9/+8
| | | | | | | | not integer constant expressions. In passing, fix the 'folding is an extension' diagnostic to not claim we're accepting the code, since that's not true in -pedantic-errors mode, and add this diagnostic to -Wgnu. llvm-svn: 148209
* Use a smaller vector than SmallVector.Benjamin Kramer2012-01-141-3/+2
| | | | | | Shrinks OverloadCandidate from 208 to 168 bytes. llvm-svn: 148204
* Progress towards making isUsed() reflect whether a declaration is odr-used; ↵Eli Friedman2012-01-131-10/+0
| | | | | | | | don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate. I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check. Someone who actually understands the semantics here should fix that. llvm-svn: 148158
* objc: do not warn when converting to a const id qualfied by itsFariborz Jahanian2012-01-121-1/+3
| | | | | | list of protools. // rdar://10669694 llvm-svn: 148051
* Start refactoring code for capturing variables and 'this' so that it is ↵Eli Friedman2012-01-111-13/+17
| | | | | | shared between lambda expressions and block literals. llvm-svn: 147917
* More lambda work: semantic analysis of capturing 'this'. It's a bit ↵Eli Friedman2012-01-071-0/+1
| | | | | | complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.) llvm-svn: 147723
* Minor refactoring of sentinel warning on blocks. Add a test for this warning.Eli Friedman2012-01-061-6/+0
| | | | llvm-svn: 147641
* More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman2012-01-051-2/+2
| | | | | | pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. llvm-svn: 147595
* Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer2011-12-231-5/+5
| | | | | | | | so this patch is surprisingly small. Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility. llvm-svn: 147221
* C++11 half of r147023: In C++11, additionally eagerly instantiate:Richard Smith2011-12-211-3/+8
| | | | | | | | - constexpr function template instantiations - variables of reference type - constexpr variables llvm-svn: 147031
* C++ constant expression handling: eagerly instantiate static const integral dataRichard Smith2011-12-211-1/+6
| | | | | | | | members of class templates so that their values can be used in ICEs. This required reverting r105465, to get such instantiated members to be included in serialized ASTs. llvm-svn: 147023
* objc/c++: Issue diagnostic when free-standing ivar is accessed Fariborz Jahanian2011-12-201-0/+6
| | | | | | in class method instead of crash. // rdar://10593227 llvm-svn: 146998
* Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith2011-12-201-2/+17
| | | | | | | | | | | | | | | | | | | | | | Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. llvm-svn: 146955
* Silence gcc warnings.Benjamin Kramer2011-12-181-1/+2
| | | | llvm-svn: 146847
* PR11594: Don't blindly build a UnaryOperator UO_Minus on an expression whichRichard Smith2011-12-161-4/+2
| | | | | | | might not be an rvalue when checking array accesses. Instead, pass through a flag indicating the array index is negated. llvm-svn: 146753
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-151-2/+2
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
* Produce more detailed diagnostics when static_assert condition is not an ICE.Richard Smith2011-12-141-18/+33
| | | | llvm-svn: 146607
* Don't consider an overloaded operator& when the expression is actuallyDouglas Gregor2011-12-141-1/+44
| | | | | | going to be a pointer-to-member constant. Fixes <rdar://problem/10544564>. llvm-svn: 146587
* Prepare constant expression infrastructure for the generation of richerRichard Smith2011-12-121-11/+17
| | | | | | diagnostics. No functionality change. llvm-svn: 146365
* C++11 constant expressions: Don't use CheckICE in C++11; instead, determineRichard Smith2011-12-091-1/+1
| | | | | | | | | | | | whether an expression is a (core) constant expression as a side-effect of evaluation. This takes us from accepting far too few expressions as ICEs to accepting slightly too many -- fixes for the remaining cases are coming next. The diagnostics produced when an expression is found to be non-constant are currently quite poor (with generic wording but reasonable source locations), and will be improved in subsequent commits. llvm-svn: 146289
* objc: issue deprecated/unavailable diagnostic whenFariborz Jahanian2011-12-071-8/+9
| | | | | | | methods with these attributes are sent to receivers of 'id' type too. // rdar://10459930 llvm-svn: 145999
OpenPOWER on IntegriCloud