summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Implement the preference for move-construction over copy-constructionDouglas Gregor2011-01-212-16/+88
| | | | | | | | | | | | when returning an NRVO candidate expression. For example, this properly picks the move constructor when dealing with code such as MoveOnlyType f() { MoveOnlyType mot; return mot; } The previously-XFAIL'd rvalue-references test case now works, and has been moved into the appropriate paragraph-specific test case. llvm-svn: 123992
* We love parenthesesDouglas Gregor2011-01-211-2/+2
| | | | llvm-svn: 123983
* Promote the static getNRVOCandidate() function, which computed theDouglas Gregor2011-01-213-23/+32
| | | | | | | | | | | | | 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
* Implement core issue 1164, which concerns the partial ordering ofDouglas Gregor2011-01-211-47/+87
| | | | | | f(T&) and f(T&&). llvm-svn: 123981
* Add test for overload resolution's preference for binding an rvalueDouglas Gregor2011-01-211-3/+3
| | | | | | | reference to an rvalue rather than binding a const-qualified lvalue reference to that rvalue. llvm-svn: 123979
* Eliminate an unused variableDouglas Gregor2011-01-211-4/+0
| | | | llvm-svn: 123978
* Update the reference-binding implementation used for overloadDouglas Gregor2011-01-212-72/+59
| | | | | | | | resolution to match the latest C++0x working paper's semantics. The implementation now matching up with the reference-binding implementation used for initialization. llvm-svn: 123977
* Implement the special template argument deduction rule for T&& in aDouglas Gregor2011-01-212-3/+40
| | | | | | | | | | | call (C++0x [temp.deduct.call]p3). As part of this, start improving the reference-binding implementation used in the computation of implicit conversion sequences (for overload resolution) to reflect C++0x semantics. It still needs more work and testing, of course. llvm-svn: 123966
* Sema: process non-inheritable attributes on function declarations earlyPeter Collingbourne2011-01-212-28/+28
| | | | | | | This allows us to simplify the handling for the overloadable attribute, removing a number of FIXMEs. llvm-svn: 123961
* Sema: support for processing non-inheritable declaration attributes earlyPeter Collingbourne2011-01-211-22/+49
| | | | llvm-svn: 123960
* Generalise support for non-inheritable attributesPeter Collingbourne2011-01-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Inheritable attributes on declarations may be inherited by any later redeclaration at merge time. By contrast, a non-inheritable attribute will not be inherited by later redeclarations. Non-inheritable attributes may be semantically analysed early, allowing them to influence the redeclaration/overloading process. Before this change, the "overloadable" attribute received special handling to be treated as non-inheritable, while all other attributes were treated as inheritable. This patch generalises the concept, while removing a FIXME. Some CUDA location attributes are also marked as non-inheritable in order to support special overloading semantics (to be introduced in a later patch). The patch introduces a new Attr subclass, InheritableAttr, from which all inheritable attributes derive. Non-inheritable attributes simply derive from Attr. N.B. I did not review every attribute to determine whether it should be marked non-inheritable. This can be done later on an incremental basis, as this change does not affect default functionality. llvm-svn: 123959
* Improve the diagnostic that complains about binding an rvalueDouglas Gregor2011-01-211-0/+1
| | | | | | reference to an lvalue. llvm-svn: 123953
* More work to bring reference binding up to the latest C++0xDouglas Gregor2011-01-211-6/+11
| | | | | | | | | | specification. In particular, an rvalue reference can bind to an initializer expression that is an lvalue if the referent type and the initializer expression type are not reference-related. This is a newer formulation to the previous "rvalue references can never bind to lvalues" rule. llvm-svn: 123952
* When performing reference binding via a conversion function, performDouglas Gregor2011-01-211-7/+2
| | | | | | | type checking based on the actual reference type we're trying to bind the result to, rather than stripping the reference. llvm-svn: 123950
* Initialize a variable, found by Ted.Fariborz Jahanian2011-01-201-1/+1
| | | | llvm-svn: 123948
* Fix a use of uninitialized variables, found by Ted!Douglas Gregor2011-01-201-7/+9
| | | | llvm-svn: 123947
* Start refactoring reference binding to more closely match the C++0xDouglas Gregor2011-01-201-34/+35
| | | | | | | working paper's structure. The only functional change here is that we now handling binding to array rvalues, which we would previously reject. llvm-svn: 123918
* Diagnose when a virtual member function marked final is overridden.Anders Carlsson2011-01-202-14/+17
| | | | llvm-svn: 123916
* Add some tests for reference-collapsing and referencing bindingDouglas Gregor2011-01-202-11/+9
| | | | | | | | | involving rvalue references, to start scoping out what is and what isn't implemented. In the process, tweak some standards citations, type desugaring, and teach the tentative parser about && in ptr-operator. llvm-svn: 123913
* When instantiating member functions, propagate whether the member function ↵Anders Carlsson2011-01-201-0/+4
| | | | | | | | is marked 'final' and 'override'. Also, call CheckOverrideControl when instantiating member functions. llvm-svn: 123900
* When checking for functions marked override, ignore dependent contexts.Anders Carlsson2011-01-201-0/+3
| | | | llvm-svn: 123894
* Make CheckOverrideControl a member of Sema.Anders Carlsson2011-01-201-4/+3
| | | | llvm-svn: 123893
* Diagnose virtual member functions marked override but not overriding any ↵Anders Carlsson2011-01-202-3/+30
| | | | | | virtual member functions. llvm-svn: 123888
* Only allow virtual member functions to be marked 'override' and 'final'.Anders Carlsson2011-01-201-0/+16
| | | | llvm-svn: 123882
* Pass the VirtSpecifiers along to Sema::ActOnCXXMemberDeclarator.Anders Carlsson2011-01-201-1/+2
| | | | llvm-svn: 123878
* Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. IRafael Espindola2011-01-201-1/+1
| | | | | | | failed to find a case where an enum context would make a difference, but found PR9007 on the way. llvm-svn: 123871
* When building a user-defined conversion sequence, keep track of theDouglas Gregor2011-01-202-3/+9
| | | | | | | 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-203-14/+24
| | | | | | | so allow it to propagate the failure outward. Fixes the crashing part of <rdar://problem/8876150>. llvm-svn: 123863
* Explicitly track the number of call arguments provided when performingDouglas Gregor2011-01-191-4/+13
| | | | | | | overload resolution, so that we only use that number of call arguments for partial ordering. Fixes PR9006, a recent regression. llvm-svn: 123861
* Downgrade the "variadic templates are a C++0x feature" error to anDouglas Gregor2011-01-191-1/+1
| | | | | | | | ExtWarn. We want variadic templates to be usable in libc++/libstdc++ headers even when we're in C++98/03 mode, since it's the only clean way to implement TR1 <functional>. llvm-svn: 123852
* Implement basic support for the use of variadic templates and blocksDouglas Gregor2011-01-192-12/+37
| | | | | | | | | | | | | | | | | together. In particular: - Handle the use of captured parameter pack names within blocks (BlockDeclRefExpr understands parameter packs now) - Handle the declaration and expansion of parameter packs within a block's parameter list, e.g., ^(Args ...args) { ... }) - Handle instantiation of blocks where the return type was not explicitly specified. (unrelated, but necessary for my tests). Together, these fixes should make blocks and variadic templates work reasonably well together. Note that BlockDeclRefExpr is still broken w.r.t. its computation of type and value dependence, which will still cause problems for blocks in templates. llvm-svn: 123849
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-195-32/+214
| | | | | | | | | | | | | | | | | | | | | a pack expansion, e.g., the parameter pack Values in: template<typename ...Types> struct Outer { template<Types ...Values> struct Inner; }; This new implementation approach introduces the notion of an "expanded" non-type template parameter pack, for which we have already expanded the types of the parameter pack (to, say, "int*, float*", for Outer<int*, float*>) but have not yet expanded the values. Aside from creating these expanded non-type template parameter packs, this patch updates template argument checking and non-type template parameter pack instantiation to make use of the appropriate types in the parameter pack. llvm-svn: 123845
* NonTypeTemplateParmDecls always have TypeSourceInfo. There's no senseDouglas Gregor2011-01-191-10/+4
| | | | | | in pretending otherwise. llvm-svn: 123839
* Warn about the use of unparenthesized |= in conditionals (which may beDouglas Gregor2011-01-191-5/+15
| | | | | | a typo for !=). Fixes PR9001, from Hans Wennborg! llvm-svn: 123836
* When building the copy expression for a __block variable, make sureJohn McCall2011-01-192-57/+51
| | | | | | | there's a respectable point of instantiation. Also, make sure we do this operation even when instantiating a dependently-typed variable. llvm-svn: 123818
* Change the canonical representation of array types to store qualifiers on theJohn McCall2011-01-192-13/+16
| | | | | | | | | | | | outermost array types and not on the element type. Move the CanonicalType member from Type to ExtQualsTypeCommonBase; the canonical type on an ExtQuals node includes the qualifiers on the ExtQuals. Assorted optimizations enabled by this change. getQualifiers(), hasQualifiers(), etc. should all now implicitly look through array types. llvm-svn: 123817
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-1910-36/+36
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* lib/Sema/SemaExpr.cpp: __null should be LongLongTy on LLP64 Win64.NAKAMURA Takumi2011-01-191-2/+9
| | | | llvm-svn: 123791
* Teach UninitializedValuesV2 to implicitly reason about C++Ted Kremenek2011-01-181-7/+3
| | | | | | | | references by monitoring whether an access to a variable is solely to compute it's lvalue or to do an lvalue-to-rvalue conversion (i.e., a load). llvm-svn: 123777
* Properly do a float -> _Complex double conversion, fixes rdar://8875946.Argyrios Kyrtzidis2011-01-181-1/+2
| | | | llvm-svn: 123759
* Generalize some operations on qualifiers. QualType::getQualifiers() andJohn McCall2011-01-181-1/+2
| | | | | | | ::getCVRQualifiers() now look through array types, like all the other standard queries. Also, make a 'split' variant of getUnqualifiedType(). llvm-svn: 123751
* Add support for explicit constructor calls in Microsoft mode.Francois Pichet2011-01-182-1/+11
| | | | | | | | | | | | | | | | | | | For example: class A{ public: A& operator=(const A& that) { if (this != &that) { this->A::~A(); this->A::A(that); // <=== explicit constructor call. } return *this; } }; More work will be needed to support an explicit call to a template constructor. llvm-svn: 123735
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-187-15/+2
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Handle base and member destructors in CheckFallThrough.Anders Carlsson2011-01-171-1/+10
| | | | llvm-svn: 123667
* Convert "#pragma unused(...)" into tokens for the parser.Argyrios Kyrtzidis2011-01-171-27/+21
| | | | | | | This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function. Fixes rdar://8829590&8770988. llvm-svn: 123666
* Change ParseOptionalCXX0XVirtSpecifierSeq to take a VirtSpecifiers struct.Anders Carlsson2011-01-171-0/+28
| | | | | | | Enforce C++[class.mem]p8: A virt-specifier-seq shall contain at most one of each virt-specifier. llvm-svn: 123611
* Fix a bug where the -Wmissing-noreturn would always treat constructors with ↵Anders Carlsson2011-01-161-0/+6
| | | | | | base or member initializers as noreturn. llvm-svn: 123603
* Emit an extension diagnostic for C99 designated initializers that appear in ↵Douglas Gregor2011-01-161-0/+5
| | | | | | C++ code llvm-svn: 123582
* Tweak the partial ordering rules for function templates to prefer aDouglas Gregor2011-01-161-2/+30
| | | | | | | | non-variadic function template over a variadic one. This matches GCC and the intent of the C++0x wording, in a way that I think is likely to be acceptable to the committee. llvm-svn: 123581
* Introduce a new kind of TemplateName that captures a substitutedDouglas Gregor2011-01-152-7/+88
| | | | | | | | | | | | | | | template template parameter pack that cannot be fully expanded because its enclosing pack expansion could not be expanded. This form of TemplateName plays the same role as SubstTemplateTypeParmPackType and SubstNonTypeTemplateParmPackExpr do for template type parameter packs and non-type template parameter packs, respectively. We should now handle these multi-level pack expansion substitutions anywhere. The largest remaining gap in our variadic-templates support is that we cannot cope with non-type template parameter packs whose type is a pack expansion. llvm-svn: 123521
OpenPOWER on IntegriCloud