summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach the __is_trivially_assignable and __is_trivially_constructibleDouglas Gregor2012-06-291-2/+33
| | | | | | | type traits that assignment to/construction of a lifetime-qualified object under ARC is *not* trivial. Fixes <rdar://problem/11738725>. llvm-svn: 159401
* Documentation cleanup: turn "//" into "///" for a Doxygen comment.James Dennett2012-06-221-3/+5
| | | | llvm-svn: 158965
* Do a second lookup for type_info in the global namespace in microsoft mode. ↵Nico Weber2012-06-191-0/+6
| | | | | | PR13153. llvm-svn: 158768
* Documentation cleanup:James Dennett2012-06-151-10/+7
| | | | | | | | | * Escaped "::" and "<" as needed in Doxygen comments; * Marked up code examples with \code...\endcode; * Documented a \param that is current, instead of a few that aren't; * Fixed up some \file and \brief comments. llvm-svn: 158562
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-101-1/+1
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* Get rid of some non-ASCII en-dashes that crept in.Eli Friedman2012-05-241-7/+7
| | | | llvm-svn: 157434
* Implement the C++11 discarded value expression rules for volatile lvalues. ↵Eli Friedman2012-05-241-2/+70
| | | | | | <rdar://problem/10790820>. llvm-svn: 157420
* Error when using typeid() with -fno-rtti. PR 12888.Nico Weber2012-05-201-0/+4
| | | | llvm-svn: 157139
* Include the correct conversion context locations for condition expressions.David Blaikie2012-05-161-2/+2
| | | | | | | | | | | | | This improves the conversion diagnostics (by correctly pointing to the loop construct for conversions that may've been caused by the contextual conversion to bool caused by a condition expression) and also causes the NULL conversion warnings to be correctly suppressed when crossing a macro boundary in such a context. (previously, since the conversion context location was incorrect, the suppression could not be performed) Reported by Nico Weber as feedback to r156826. llvm-svn: 156901
* When diagnosing inaccessible temporary destructors in decltype expressions, useRichard Smith2012-05-111-4/+4
| | | | | | | the correct type and the correct source location in the diagnostic. Spotted by Johannes Schaub! llvm-svn: 156654
* Move Sema::VerifyIntegerConstantExpression() andDouglas Gregor2012-05-041-16/+63
| | | | | | | | Sema::ConvertToIntegralOrEnumerationType() from PartialDiagnostics to abstract "diagnoser" classes. Not much of a win here, but we're -several PartialDiagnostics. llvm-svn: 156217
* Move Sema::RequireNonAbstractType() off of PartialDiagnostic.Douglas Gregor2012-05-041-2/+1
| | | | llvm-svn: 156180
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-15/+10
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'Richard Smith2012-04-301-4/+0
| | | | | | | | | | being used in an exception specification in a way which isn't otherwise ill-formed in C++98: this warning also incorrectly triggered on uses of 'this' inside thread-safety attributes, and the mechanism required to tell these cases apart is more complex than can be justified by the (minimal) value of this part of -Wc++98-compat. llvm-svn: 155857
* Revert "Use the C++11 definition of PODness for __is_pod in C++11 mode."Benjamin Kramer2012-04-281-2/+1
| | | | | | This is just papering over a major bug in isPODType, real fix coming up soon. llvm-svn: 155755
* Use the C++11 definition of PODness for __is_pod in C++11 mode.Benjamin Kramer2012-04-281-1/+2
| | | | | | Keep the old definition for C++98 so we don't break tr1::is_pod. llvm-svn: 155754
* Two missing -Wc++98-compat warnings, for null pointers as non-type templateRichard Smith2012-04-261-0/+4
| | | | | | arguments, and 'this' in exception-specifications. llvm-svn: 155606
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-2/+2
| | | | llvm-svn: 155082
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. llvm-svn: 154886
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-11/+49
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Fix some i1/i8 confusion within _Atomic(bool) in IR generation, bothDouglas Gregor2012-04-121-0/+7
| | | | | | | | | | | | | | in general (such an atomic has boolean representation) and specifically for IR generation of __c11_atomic_init. The latter also means actually using initialization semantics for this initialization, rather than just creating a store. On a related note, make sure we actually put in non-atomic-to-atomic conversions when performing an implicit conversion sequence. IR generation is far too kind here, but we still want the ASTs to make sense. llvm-svn: 154612
* Fix several problems with protected access control:John McCall2012-04-071-2/+3
| | | | | | | | | | | | | | | | | | | | | - The [class.protected] restriction is non-trivial for any instance member, even if the access lacks an object (for example, if it's a pointer-to-member constant). In this case, it is equivalent to requiring the naming class to equal the context class. - The [class.protected] restriction applies to accesses to constructors and destructors. A protected constructor or destructor can only be used to create or destroy a base subobject, as a direct result. - Several places were dropping or misapplying object information. The standard could really be much clearer about what the object type is supposed to be in some of these accesses. Usually it's easy enough to find a reasonable answer, but still, the standard makes a very confident statement about accesses to instance members only being possible in either pointer-to-member literals or member access expressions, which just completely ignores concepts like constructor and destructor calls, using declarations, unevaluated field references, etc. llvm-svn: 154248
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-2/+1
| | | | | | member function is deleted. llvm-svn: 153773
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-26/+26
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Fix crash & accepts-invalid for array of arrays of user defined type.David Blaikie2012-03-101-8/+11
| | | | | | | Test case/other help by Richard Smith. Code review by John McCall. llvm-svn: 152519
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-0/+1
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [Sema] Fix a diag change to include a range that appeared intended, but neverDaniel Dunbar2012-03-091-1/+2
| | | | | | actually happened. llvm-svn: 152442
* [Sema] Remove dead getSourceRange() call, caught by Clang after markingDaniel Dunbar2012-03-091-2/+1
| | | | | | LLVM_READONLY. llvm-svn: 152428
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-13/+13
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* Perform l2r conversions on delete operands before doingJohn McCall2012-03-091-3/+3
| | | | | | | type-analysis; otherwise, we just completely do the wrong thing for placeholders. llvm-svn: 152375
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-9/+18
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* If the element type of an initializer list has a destructor, make sure we ↵Sebastian Redl2012-03-051-2/+1
| | | | | | check it. Fixes PR12178. llvm-svn: 152048
* Implement "optimization" for lambda-to-block conversion which inlines the ↵Eli Friedman2012-03-011-5/+37
| | | | | | | | generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap. Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed. llvm-svn: 151797
* Tighten type-checking a bit to make it clearer how BuildCXXMemberCallExpr is ↵Eli Friedman2012-03-011-2/+3
| | | | | | used. llvm-svn: 151783
* Make sure list-initialization of arrays works correctly in explicit type ↵Eli Friedman2012-02-291-14/+18
| | | | | | conversions. PR12121. llvm-svn: 151674
* Ensure that we delete destructors in the right cases. Specifically:Richard Smith2012-02-261-4/+10
| | | | | | | | | | | | | | - variant members with nontrivial destructors make the containing class's destructor deleted - check for a virtual destructor after checking for overridden methods in the base class(es) - check for an inaccessible operator delete for a class with a virtual destructor. Do not try to call an anonymous union field's destructor from the destructor of the containing class. llvm-svn: 151483
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-8/+16
| | | | llvm-svn: 151447
* Fix assertion (too few Diag arguments) when diagnosing a deleted operator deleteRichard Smith2012-02-251-1/+2
| | | | llvm-svn: 151442
* Fix comment: correct predicate name, reformat comment.Dmitri Gribenko2012-02-241-5/+4
| | | | llvm-svn: 151389
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+121
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Provide the __is_trivially_assignable type trait, which providesDouglas Gregor2012-02-231-0/+49
| | | | | | | compiler support for the std::is_trivially_assignable library type trait. llvm-svn: 151240
* Throw away stray CXXDefaultArgExprs. Fixes PR12061.Sebastian Redl2012-02-221-0/+7
| | | | | | I think there's a deeper problem here in the way TransformCXXConstructExpr works, but I won't tackle it now. llvm-svn: 151146
* Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is aRichard Smith2012-02-221-8/+104
| | | | | | | | | | | | | | | | | | function call (or a comma expression with a function call on its right-hand side), possibly parenthesized, then the return type is not required to be complete and a temporary is not bound. Other subexpressions inside a decltype expression do not get this treatment. This is implemented by deferring the relevant checks for all calls immediately within a decltype expression, then, when the expression is fully-parsed, checking the relevant constraints and stripping off any top-level temporary binding. Deferring the completion of the return type exposed a bug in overload resolution where completion of the argument types was not attempted, which is also fixed by this change. llvm-svn: 151117
* Emit a warning when list-initializing a std::initializer_list member.Sebastian Redl2012-02-191-1/+1
| | | | llvm-svn: 150933
* Rewrite variable capture within lambda expressions and blocks,Douglas Gregor2012-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eliminating a bunch of redundant code and properly modeling how the captures of outside blocks/lambdas affect the types seen by inner captures. This new scheme makes two passes over the capturing scope stack. The first pass goes up the stack (from innermost to outermost), assessing whether the capture looks feasible and stopping when it either hits the scope where the variable is declared or when it finds an existing capture. The second pass then walks down the stack (from outermost to innermost), capturing the variable at each step and updating the captured type and the type that an expression referring to that captured variable would see. It also checks type-specific restrictions, such as the inability to capture an array within a block. Note that only the first odr-use of each variable needs to do the full walk; subsequent uses will find the capture immediately, so multiple walks need not occur. The same routine that builds the captures can also compute the type of the captures without signaling errors and without actually performing the capture. This functionality is used to determine the type of declaration references as well as implementing the weird decltype((x)) rule within lambda expressions. The capture code now explicitly takes sides in the debate over C++ core issue 1249, which concerns the type of captures within nested lambdas. We opt to use the more permissive, more useful definition implemented by GCC rather than the one implemented by EDG. llvm-svn: 150875
* Add a bunch of missing calls to DiagnoseSentinelCalls. ↵Eli Friedman2012-02-181-0/+5
| | | | | | | | <rdar://problem/10885993>. This should probably be refactored... but it isn't completely obvious what refactoring is best. llvm-svn: 150869
* Diagnose uses of deleted destructors and inaccessible defaulted destructors.Richard Smith2012-02-181-8/+15
| | | | | | | | | | We had two separate issues here: firstly, varions functions were assuming that they did not need to perform semantic checks on trivial destructors (this is not true in C++11, where a trivial destructor can nonetheless be private or deleted), and a bunch of DiagnoseUseOfDecl calls were missing for uses of destructors. llvm-svn: 150866
* Don't allow non-empty ParenListExprs as array-new initializers.Sebastian Redl2012-02-171-5/+2
| | | | | | Don't know what I was thinking there. Fixes PR12023. llvm-svn: 150804
* Proper checking of list-initializers for array new expressions.Sebastian Redl2012-02-161-9/+28
| | | | | | This finishes generalized initializer support in Sema. llvm-svn: 150688
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-161-84/+92
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
OpenPOWER on IntegriCloud