summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a missed case in the NULL operand to conditional operatorChandler Carruth2011-02-191-0/+4
| | | | | | | | diagnostics. Patch by Stephen Hines. llvm-svn: 125998
* Initial steps to improve diagnostics when there is a NULL andChandler Carruth2011-02-181-6/+14
| | | | | | | | a non-pointer on the two sides of a conditional expression. Patch by Stephen Hines and Mihai Rusu. llvm-svn: 125995
* Enhance the array bounds checking to work for several other constructs,Chandler Carruth2011-02-171-0/+4
| | | | | | | | | especially C++ code, and generally expand the test coverage. Logic adapted from a patch by Kaelyn Uhrain <rikka@google.com> and another Googler. llvm-svn: 125775
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-13/+4
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* Implement objective-c++'s block pointer type matching involvingFariborz Jahanian2011-02-121-1/+6
| | | | | | | types which are contravariance in argument types and covariance in return types. // rdar://8979379. llvm-svn: 125445
* Support for objextive-c++ use of property-dot syntax as receiverFariborz Jahanian2011-02-081-2/+2
| | | | | | | in liu of a class method getter. // rdar://8962253 llvm-svn: 125094
* Sema::MaybeBindToTemporary() shouldn't treat any expression returningDouglas Gregor2011-02-081-11/+3
| | | | | | | | | a glvalue as a temporary. Previously, we were enumerating all of the cases that coul return glvalues and might be called with Sema::MaybeBindToTemporary(), but that was gross and we missed the Objective-C property reference case. llvm-svn: 125070
* More capturing of 'this': implicit member expressions. Getting thatJohn McCall2011-02-031-10/+24
| | | | | | | | | | | right for anonymous struct/union members led to me discovering some seemingly broken code in that area of Sema, which I fixed, partly by changing the representation of member pointer constants so that IndirectFieldDecls aren't expanded. This led to assorted cleanups with member pointers in CodeGen, and while I was doing that I saw some random other things to clean up. llvm-svn: 124785
* An insomniac stab at making block declarations list the variables they closeJohn McCall2011-02-021-7/+17
| | | | | | | on, as well as more reliably limiting invalid references to locals from nested scopes. llvm-svn: 124721
* Implement access checking for the "delete" operator. Fixes PR9050,Douglas Gregor2011-02-011-1/+9
| | | | | | from Alex Miller! llvm-svn: 124663
* Fix some corner cases in the __is_base_of logic.John McCall2011-01-281-20/+27
| | | | llvm-svn: 124505
* Give OpaqueValueExpr a source location, because its source locationDouglas Gregor2011-01-281-1/+1
| | | | | | | | might be queried in places where we absolutely require a valid location (e.g., for template instantiation). Fixes some major brokenness in the use of __is_convertible_to. llvm-svn: 124465
* Teach the evaluation of the __is_convertible_to trait to translateDouglas Gregor2011-01-271-4/+5
| | | | | | | | | | | | | | | access control errors into SFINAE errors, so that the trait provides enough support to implement the C++0x std::is_convertible type trait. To get there, the SFINAETrap now knows how to set up a SFINAE context independent of any template instantiations or template argument deduction steps, and (separately) can set a Sema flag to translate access control errors into SFINAE errors. The latter can also be useful if we decide that access control errors during template argument deduction should cause substitution failure (rather than a hard error) as has been proposed for C++0x. llvm-svn: 124446
* Document some serious badness in our evaluation of the type traits: we need ↵Douglas Gregor2011-01-271-0/+2
| | | | | | to be sure we have complete types in many cases llvm-svn: 124428
* Implement the Microsoft __is_convertible_to type trait, modeling theDouglas Gregor2011-01-271-1/+47
| | | | | | | | | | semantics after the C++0x is_convertible type trait. This implementation is not 100% complete, because it allows access errors to be hard errors (rather than just evaluating false). Original patch by Steven Watanabe! llvm-svn: 124425
* Revert r124217 because it didn't catch the actual error case it was trying toJeffrey Yasskin2011-01-271-4/+1
| | | | | | | | | | catch: lock_guard(my_mutex); declares a variable instead of creating a temporary. llvm-svn: 124398
* Do a proper recursive lookup when deciding whether a class's usualJohn McCall2011-01-271-3/+84
| | | | | | | | | deallocation function has a two-argument form. Store the result of this check in new[] and delete[] nodes. Fixes rdar://problem/8913519 llvm-svn: 124373
* Fix whitespace.NAKAMURA Takumi2011-01-271-246/+246
| | | | llvm-svn: 124364
* 7bit-ize.NAKAMURA Takumi2011-01-271-9/+9
| | | | llvm-svn: 124363
* Fix a horrible bug in our handling of C-style casting, where a C-styleDouglas Gregor2011-01-271-9/+8
| | | | | | | | | | | derived-to-base cast that also casts away constness (one of the cases for static_cast followed by const_cast) would be treated as a bit-cast rather than a derived-to-base class, causing miscompiles and heartburn. Fixes <rdar://problem/8913298>. llvm-svn: 124340
* Reference qualifiers for *this: implement C++0x [expr.mptr.oper]p6,Douglas Gregor2011-01-261-0/+26
| | | | | | | the restrictions on .* and ->* for ref-qualified pointer-to-member functions. llvm-svn: 124294
* Add an attribute to forbid temporary instances of a type. This allows classJeffrey Yasskin2011-01-251-1/+4
| | | | | | | | | | | | | | | authors to write class __attribute__((forbid_temporaries)) Name { ... }; when they want to force users to name all variables of the type. This protects people from doing things like creating a scoped_lock that only lives for a single statement instead of an entire scope. The warning produced by this attribute can be disabled by -Wno-forbid-temporaries. llvm-svn: 124217
* When throwing an elidable object, first try to treat the subexpressionDouglas Gregor2011-01-211-5/+6
| | | | | | | as an rvalue per C++0x [class.copy]p33. If that fails, try again with the original subexpression. llvm-svn: 124002
* Promote the static getNRVOCandidate() function, which computed theDouglas Gregor2011-01-211-1/+1
| | | | | | | | | | | | | NRVO candidate for a return statement, to Sema::getCopyElisionCandidate(), and teach it enough to also determine the NRVO candidate for a throw expression. We still don't use the latter information, however. Along the way, implement core issue 1148, which eliminates copy elision from catch parameters and clarifies that copy elision cannot occur from function parameters (which we already implemented). llvm-svn: 123982
* When building a user-defined conversion sequence, keep track of theDouglas Gregor2011-01-201-3/+4
| | | | | | | declaration that name lookup actually found, so that we can use it for access checking later on. Fixes <rdar://problem/8876150>. llvm-svn: 123867
* Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,Douglas Gregor2011-01-201-6/+8
| | | | | | | so allow it to propagate the failure outward. Fixes the crashing part of <rdar://problem/8876150>. llvm-svn: 123863
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-1/+1
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-1/+0
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* More __uuidof validation:Francois Pichet2010-12-271-18/+23
| | | | | | | 1. Do not validate for uuid attribute if the type is template dependent. 2. Search every class declaration and definition for the uuid attribute. llvm-svn: 122578
* XFAIL vtable-debug-info.cpp on WIN32 and fix curly brace.Francois Pichet2010-12-201-2/+1
| | | | llvm-svn: 122230
* Emit an error if operator __uuidof() is called on a type with no associated ↵Francois Pichet2010-12-201-0/+25
| | | | | | GUID. llvm-svn: 122226
* Motions towards simplifying how we deal with attribute-qualified function types.John McCall2010-12-191-2/+1
| | | | llvm-svn: 122162
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-151-1/+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
* Restore r121752 without modification.John McCall2010-12-141-9/+15
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-15/+9
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-9/+15
| | | | | | | 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
* Variadic templates: extend Type, NestedNameSpecifier, TemplateName,Douglas Gregor2010-12-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | and TemplateArgument with an operation that determines whether there are any unexpanded parameter packs within that construct. Use this information to diagnose the appearance of the names of parameter packs that have not been expanded (C++ [temp.variadic]p5). Since this property is checked often (every declaration, ever expression statement, etc.), we extend Type and Expr with a bit storing the result of this computation, rather than walking the AST each time to determine whether any unexpanded parameter packs occur. This commit is deficient in several ways, which will be remedied with future commits: - Expr has a bit to store the presence of an unexpanded parameter pack, but it is never set. - The error messages don't point out where the unexpanded parameter packs were named in the type/expression, but they should. - We don't check for unexpanded parameter packs in all of the places where we should. - Testing is sparse, pending the resolution of the above three issues. llvm-svn: 121724
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-1/+18
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Bump up property conversion earlier in the initialization process. FixesJohn McCall2010-12-071-1/+1
| | | | | | the failed compile in PR8751. llvm-svn: 121192
* Kill FullExpr, as it was not, in fact, used anywhere in the code base.John McCall2010-12-071-16/+0
| | | | | | | I'm not opposed to the idea in concept, but there's no point in preserving abortive experiments. llvm-svn: 121083
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-071-0/+71
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-10/+10
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* First pass at implementing the intent of ANSI C DR106.John McCall2010-12-041-2/+3
| | | | llvm-svn: 120904
* dyn_cast else unreachable -> castJohn McCall2010-12-041-4/+2
| | | | llvm-svn: 120902
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-15/+47
| | | | | | | | | | | | | | | | | | | 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
* When we're performing an explicit cast of some sort, don't complainDouglas Gregor2010-12-021-2/+2
| | | | | | | | | about deprecated Objective-C pointer conversions. Plus, make sure to actually set an appropriate AssignmentAction when performing an implicit conversion from an InitializationSequence. Fixes regressions in the GCC DejaGNU testsuite. llvm-svn: 120744
* Perform lvalue-to-rvalue at the end of an expression statement in C.John McCall2010-12-021-0/+12
| | | | llvm-svn: 120646
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-1/+1
| | | | llvm-svn: 120084
* Add an assertion, fix a whole bunch of bugs, comment the assertionJohn McCall2010-11-181-5/+12
| | | | | | out because there are still bugs left. llvm-svn: 119722
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-24/+52
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
OpenPOWER on IntegriCloud