aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
AgeCommit message (Collapse)Author
2009-10-12Permit explicit specialization of member functions of class templatesDouglas Gregor
that are declarations (rather than definitions). Also, be sure to set the access specifiers properly when instantiating the declarations of member function templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12More appropriate API usage.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12Implement -Wparentheses: warn about using assignments in contexts that requireJohn McCall
conditions. Add a fixit to insert the parentheses. Also fix a very minor possible memory leak in 'for' conditions. Fixes PR 4876 and rdar://problem/7289172 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12Diagnose the declaration of explicit specializations after an implicitDouglas Gregor
instantiation has already been required. To do so, keep track of the point of instantiation for anything that can be instantiated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12Handle built-in unary operators when reporting ambiguities.Fariborz Jahanian
wip - To prune excessive reporting. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12If built-in operators could not be selected because of ambiguity inFariborz Jahanian
user-defined type conversions, issue list of ambiguites in addition to the diagnostic. So, clang now issues the following: b.cpp:19:19: error: left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct C1' int i = c1->*pmf; ~~^ b.cpp:19:19: note: because of ambiguity in conversion of 'struct C1' to 'struct E *' b.cpp:5:5: note: candidate function operator E*(); ^ b.cpp:11:5: note: candidate function operator E*(); ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11Types appearing more than once in a spec shouldn't matter.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11Test exception spec compatibility on return type and parameters.Sebastian Redl
Along the way, use RequireCompleteType when testing exception spec types. Separate all the ugly spec stuff into its own file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10Implement the core checking for compatible exception specifications in ↵Sebastian Redl
assignment and initialization. The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet. This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10Qualified lookup through using declarations. Diagnose a new type of ambiguity.John McCall
Split the various ambiguous result enumerators into their own enum. Tests for most of C++ [namespace.qual]. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10Check that the return type is complete when calling a member function.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Add CheckCallReturnType and start using it for regular call expressions. ↵Anders Carlsson
This will improve error messages. For struct B; B f(); void g() { f(); } We now get t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B' f(); ^~~ t.cpp:3:3: note: 'f' declared here B f(); ^ t.cpp:1:8: note: forward declaration of 'struct B' struct B; ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83692 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Dead Code EliminationDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Add some FIXMEsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Minor tweaks for code-completion:Douglas Gregor
- Filter out unnamed declarations - Filter out declarations whose names are reserved for the implementation (e.g., __bar, _Foo) - Place OVERLOAD: or COMPLETION: at the beginning of each code-completion result, so we can easily separate them from other compilation results. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Refactor the LookupResult API to simplify most common operations. Require ↵John McCall
users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83674 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09When declaring a friend class template, we may end up finding anDouglas Gregor
injected-class-name (e.g., when we're referring to other specializations of the current class template). Make sure that we see the template rather than the injected-class-name. Fixes PR4768. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83672 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Produce good looking diagnostics on ambiguous built-in operators.Fariborz Jahanian
Now we produce things like: bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \ ~^ ~~~ bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*') bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*') ... Still need to look at an issue (indicated as FIXME in the test case). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Use the new API for applying the qualifiers on built-in '->*' Fariborz Jahanian
operator's types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09Improve on reporting ambiguity involving built-in candidates.Fariborz Jahanian
I still don't like it but it is improvement over what we had. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08- Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS ↵Steve Naroff
(compare was system dependent). Worked on Linux, failed on Mac OS (which caused the recently added testcase to fail on Linux). - Sort results in testcase. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Fix up error reporting when object cannot be constructed Fariborz Jahanian
because of missing default constructor of a member. Fixes pr5154. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Installation of Clang libraries and headers, from Axel Naumann!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Add code completion support for ObjC property declarations/attributes.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Implement support for -Wunused-variable, from Oscar Bonilla!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Add more testing for the properties of explicit specialization. Douglas Gregor
Also, eliminate a redundant diagnostic by marking a variable declared with incomplete type as an invalid declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Don't complain about out-of-line explicit specializations of memberDouglas Gregor
function and member function templates that are not definitions. Add more tests to ensure that explicit specializations of member function templates prevent instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Improve checking for specializations of member classes of classDouglas Gregor
templates, and keep track of how those member classes were instantiated or specialized. Make sure that we don't try to instantiate an explicitly-specialized member class of a class template, when that explicit specialization was a declaration rather than a definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08For instantiations of static data members of class templates, keepDouglas Gregor
track of the kind of specialization or instantiation. Also, check the scope of the specialization and ensure that a specialization declaration without an initializer is not a definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Make sure to set the template specialization kind of an explicitDouglas Gregor
template instantiation of a member function of a class template. FIXME -= 2; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08Only perform an implicit instantiation of a function if its templateDouglas Gregor
specialization kind is TSK_ImplicitInstantiation. Previously, we would end up implicitly instantiating functions that had explicit specialization declarations or explicit instantiation declarations (with no corresponding definitions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Keep track of whether a member function instantiated from a memberDouglas Gregor
function of a class template was implicitly instantiated, explicitly instantiated (declaration or definition), or explicitly specialized. The same MemberSpecializationInfo structure will be used for static data members and member classes as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Refactoring around friend class templates. Better error message for friend ↵John McCall
enums. Don't create a new declaration for friend classes if a declaration already exists. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Type checking for specializations of member functions of classDouglas Gregor
templates. Previously, these weren't handled as specializations at all. The AST for representing these as specializations is still a work in progress. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Handle MemberExprs in ResolveAddressOfOverloadedFunction.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Dead code elimination.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Diagnose explicit instantiations and specializations that occur in class scopeDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07When building candidate set for built-ins; when looking forFariborz Jahanian
convesion functions, look in base classes to. (Removes a FIXME). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Class template partial specializations can be declared anywhere thatDouglas Gregor
its definition may be defined, including in a class. Also, put in an assertion when trying to instantiate a class template partial specialization of a member template, which is not yet implemented. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Removed couple of unnecessary canonicalizationFariborz Jahanian
per Doug's obsevation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83464 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07Refactor checking of the scope of explicit template specializationDouglas Gregor
declarations and explicit template instantiations, improving diagnostics and making the code usable for function template specializations (as well as class template specializations and partial specializations). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06Patch to implement C++ [over.built]p11 of overload resolution.Fariborz Jahanian
Doug, please review. There is a FIXME in the test case with a question which is unrelated to this patch (that is, error is issued before set of builtins are added to the candidate list). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06Test explicit specialization for all of the various cases whereDouglas Gregor
explicit specializations can occur. Also, fix a minor recovery bug where we should allow declarations coming from the parser to be NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06Refactor the code that walks a C++ inheritance hierarchy, searchingDouglas Gregor
for bases, members, overridden virtual methods, etc. The operations isDerivedFrom and lookupInBases are now provided by CXXRecordDecl, rather than by Sema, so that CodeGen and other clients can use them directly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06Refixed pr5086 by letting Expr::isNullPointerConstantFariborz Jahanian
handle checking for a null pointer for a zero-valued enumerator; moving the test case from CodeGen to Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05tweaked my last patch to 1) preserve the protocol inFariborz Jahanian
extension class's protocol list so its AST is complete. 2) Because of this no need to issue warning on unimplemeted methods coming from the extended class protocols because warning is issued when class definition is seen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05Patch to implement Protocols on class extensions.Fariborz Jahanian
<rdar://problem/7269631> Protocols on class extensions don't work git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03Create CXXMemberCallExpr for pointer-to-member calls.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01Make sure to free the explicit template arguments provided for anDouglas Gregor
explicit instantiation. Also, tighten up reference-count checking to help catch these issues earlier. Fixes PR5069. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01- Remove Sema::FindMethodInNestedImplementations().Steve Naroff
- Add ObjCInterfaceDecl::lookupPrivateInstanceMethod(). - Convert clients. No functionality change - One less method in Sema:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83224 91177308-0d34-0410-b5e6-96231b3b80d8