summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* If block literal return type is not specified, return type of the block is Fariborz Jahanian2011-12-031-1/+3
| | | | | | | inferred from return types. All the return statements have to agree about the type. // rdar://10466373 llvm-svn: 145774
* When sending a message to a receiver that has "unknown any" type,Douglas Gregor2011-12-011-0/+9
| | | | | | | force the unknown any type to "id" so that the message send can be completed without requiring a case. Fixes <rdar://problem/10506646>. llvm-svn: 145552
* Test isa<FunctionDecl> to exclude objective-C methods. This ensures the ↵Lang Hames2011-11-291-1/+1
| | | | | | following cast will never fail. llvm-svn: 145441
* Remove code made redundant by my previous patch.Fariborz Jahanian2011-11-281-12/+1
| | | | llvm-svn: 145266
* pinpoint name/location of deprecated/unavailable enumeratorFariborz Jahanian2011-11-281-1/+8
| | | | | | | whose enum has been made deprecated/unavailable in the warning. // rdar://10201690 llvm-svn: 145264
* In Microsoft mode, make "Unqualified lookup into dependent bases of class ↵Francois Pichet2011-11-251-2/+13
| | | | | | | | | | templates" works inside a friend function definition at class scope. Basically we have to look into the parent *lexical* DeclContext for friend functions at class scope. That's because calling GetParent() return the namespace or file DeclContext. This fixes all remaining cases of "Unqualified lookup into dependent bases of class templates" when parsing MFC code with clang. llvm-svn: 145127
* Add feature to diagnostics that will provide more information on functionRichard Trieu2011-11-231-0/+9
| | | | | | | | | | pointer mismatch. Cases covered are: initialization, assignment, and function arguments. Additional text will give the extra information about the nature of the mismatch: different classes for member functions, wrong number of parameters, different parameter type, different return type, and function qualifier mismatch. llvm-svn: 145114
* In Microsoft mode, make "Unqualified lookup into dependent bases of class ↵Francois Pichet2011-11-171-1/+17
| | | | | | | | | | templates" works inside default argument instantiation. This is a little bit tricky because during default argument instantiation the CurContext points to a CXXMethodDecl but we can't use the keyword this or have an implicit member call generated. This fixes 2 errors when parsing MFC code with clang. llvm-svn: 144881
* In Microsoft mode, make "Unqualified lookup into dependent bases of class ↵Francois Pichet2011-11-151-1/+3
| | | | | | templates" works inside static functions. llvm-svn: 144729
* Resolve placeholder expressions before trying to deduceJohn McCall2011-11-151-4/+1
| | | | | | | 'auto'. Introduce a convenience method to make this a bit easier, and use it elsewhere. llvm-svn: 144605
* ARC: make assignment to 'self' within class methods illegal. Fixes ↵Ted Kremenek2011-11-141-1/+3
| | | | | | <rdar://problem/10416568>. llvm-svn: 144572
* Add missing casts to AST.Eli Friedman2011-11-121-1/+8
| | | | llvm-svn: 144455
* Be sure to insulate block literals from any cleanups in theirJohn McCall2011-11-111-0/+12
| | | | | | | enclosing full-expressions. It is somewhat amazing that this hasn't come up as a problem before. llvm-svn: 144362
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-11/+30
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* objc: Don't crash on missing @interface decl.Fariborz Jahanian2011-11-081-6/+7
| | | | | | // rdar://10415026 llvm-svn: 144143
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* back out changes in r143399 and r143475.Fariborz Jahanian2011-11-021-3/+0
| | | | | | | rvale-references are captured by reference in blocks. // rdar://9971124. llvm-svn: 143583
* Find copy constructor needed to copy an rvalue referenceFariborz Jahanian2011-11-011-1/+4
| | | | | | c++ object into block descriptor. // rdar://9971124 llvm-svn: 143475
* Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-011-1/+1
| | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. llvm-svn: 143417
* Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith2011-10-291-1/+1
| | | | | | | | implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
* Add (hopefully) the last missing lvalue-to-rvalue conversion. Add an assertionRichard Smith2011-10-281-2/+13
| | | | | | to catch some future implicit lvalue-to-rvalue casts of inappropriate kinds. llvm-svn: 143182
* Be sure to build a dependent expression when we seeJohn McCall2011-10-281-12/+24
| | | | | | a binary operator involving a dependently-typed overload set. llvm-svn: 143172
* Add missing lvalue-to-rvalue conversion to vector splat casts.Richard Smith2011-10-271-2/+6
| | | | llvm-svn: 143166
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-232/+178
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-178/+232
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Pull the pseudo-object stuff into its own file.John McCall2011-10-251-334/+23
| | | | | | | Tidy up some marginally related code just to annoy single-purpose-commit lovers. No functionality change. llvm-svn: 142915
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-155/+412
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* Don't forget to complete the objc interface before asking for information,Argyrios Kyrtzidis2011-10-191-1/+2
| | | | | | otherwise lldb will suffer. llvm-svn: 142471
* Move static array parameter checks to SemaExpr, per Doug's requestPeter Collingbourne2011-10-191-2/+60
| | | | llvm-svn: 142465
* Macro metaprogramming for builtin types.John McCall2011-10-181-30/+5
| | | | llvm-svn: 142420
* -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.Richard Smith2011-10-181-4/+9
| | | | llvm-svn: 142419
* Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument indexRichard Smith2011-10-171-6/+6
| | | | | | before typechecking, as suggested by John. llvm-svn: 142308
* The comparison of two vectors should return a signed result. ↵Tanya Lattner2011-10-171-9/+9
| | | | | | | | | hasIntegerRepresentation() used to always return false for vectors, but since it was changed, it also changed the return type of a compare of two unsigned vectors to be unsigned. This patch removes the check for hasIntegerRepresentation since its not needed and returns the appropriate signed type. I added a new test case and updated exisiting test cases that assumed an unsigned result. llvm-svn: 142250
* Add missing case to switch.Eli Friedman2011-10-171-0/+1
| | | | llvm-svn: 142246
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-12/+70
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Perform an lvalue-to-rvalue conversion on an array index in a ↵Richard Smith2011-10-171-1/+5
| | | | | | __builtin_offsetof expression. llvm-svn: 142179
* Slightly simplify a constant expression check. No functional change.Richard Smith2011-10-161-3/+3
| | | | llvm-svn: 142167
OpenPOWER on IntegriCloud