summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Have the exception specification checkers take partial diagnostics. Use this ↵Sebastian Redl2009-10-142-14/+19
| | | | | | to merge two diagnostics. llvm-svn: 84105
* Use CanQualType in the exception specification verification type sets.Sebastian Redl2009-10-141-3/+3
| | | | llvm-svn: 84101
* Use partial diagnostics properly in call to RequireCompleteType. Among other ↵Sebastian Redl2009-10-141-8/+6
| | | | | | things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification. llvm-svn: 84099
* Do exception spec compatibility tests for member pointers, too.Sebastian Redl2009-10-141-0/+5
| | | | llvm-svn: 84098
* Handle ambiguity of reference initialization.Fariborz Jahanian2009-10-141-1/+10
| | | | | | Removes a FIXME. llvm-svn: 84068
* Remove some non-ASCII charactersDouglas Gregor2009-10-131-2/+2
| | | | llvm-svn: 84058
* Improve diagnostics when the parser encounters a declarator with anDouglas Gregor2009-10-133-1/+38
| | | | | | | | | | | | | | | | | | | | | | | unknown type name, e.g., foo::bar x; when "bar" does not refer to a type in "foo". With this change, the parser now calls into the action to perform diagnostics and can try to recover by substituting in an appropriate type. For example, this allows us to easily diagnose some missing "typename" specifiers, which we now do: test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename' prior to dependent type name 'A<T>::type' A<T>::type A<T>::f() { return type(); } ^~~~~~~~~~ typename Fixes PR3990. llvm-svn: 84053
* Fix for PR 5181.Edward O'Callaghan2009-10-131-1/+4
| | | | llvm-svn: 84051
* The operator loc points to the operator, not the function decl.Anders Carlsson2009-10-131-1/+1
| | | | llvm-svn: 84048
* Check the return type of binary operators and the arrow operator.Anders Carlsson2009-10-132-8/+21
| | | | llvm-svn: 84043
* Check the return type of operator[]() and fix a thinko that lead to a crash ↵Anders Carlsson2009-10-131-6/+13
| | | | | | in SemaCXX/overloaded-operator.cpp. llvm-svn: 84041
* More return type checking.Anders Carlsson2009-10-132-6/+14
| | | | llvm-svn: 84034
* Diagnose invalid return types for unary operators.Anders Carlsson2009-10-131-6/+10
| | | | llvm-svn: 84030
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-137-98/+107
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Diagnose attempts to add default function arguments to aDouglas Gregor2009-10-131-0/+16
| | | | | | specialization. This completes C++ [temp.expl.spec]! llvm-svn: 83980
* When explicitly specializing a member that is a template, mark theDouglas Gregor2009-10-135-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | template as a specialization. For example, this occurs with: template<typename T> struct X { template<typename U> struct Inner { /* ... */ }; }; template<> template<typename T> struct X<int>::Inner { T member; }; We need to treat templates that are member specializations as special in two contexts: - When looking for a definition of a member template, we look through the instantiation chain until we hit the primary template *or a member specialization*. This allows us to distinguish between the primary "Inner" definition and the X<int>::Inner definition, above. - When computing all of the levels of template arguments needed to instantiate a member template, don't add template arguments from contexts outside of the instantiation of a member specialization, since the user has already manually substituted those arguments. Fix up the existing test for p18, which was actually wrong (but we didn't diagnose it because of our poor handling of member specializations of templates), and add a new test for member specializations of templates. llvm-svn: 83974
* Improve the internal representation and semantic analysis of friendDouglas Gregor2009-10-134-34/+117
| | | | | | | | | | | | | | | function templates. This commit ensures that friend function templates are constructed as FunctionTemplateDecls rather than partial FunctionDecls (as they previously were). It then implements template instantiation for friend function templates, injecting the friend function template only when no previous declaration exists at the time of instantiation. Oh, and make sure that explicit specialization declarations are not friends. llvm-svn: 83970
* make the diagnostic in the 'unused result' warning more preciseChris Lattner2009-10-131-0/+19
| | | | | | about the reason, rdar://7186119. llvm-svn: 83940
* When declaring a class template whose name is qualified, make sureDouglas Gregor2009-10-122-2/+9
| | | | | | | | that the scope in which it is being declared is complete. Also, when instantiating a member class template's ClassTemplateDecl, be sure to delay type creation so that the resulting type is dependent. Ick. llvm-svn: 83923
* Permit explicit specialization of member functions of class templatesDouglas Gregor2009-10-122-4/+14
| | | | | | | | that are declarations (rather than definitions). Also, be sure to set the access specifiers properly when instantiating the declarations of member function templates. llvm-svn: 83911
* More appropriate API usage.John McCall2009-10-121-3/+1
| | | | llvm-svn: 83910
* Implement -Wparentheses: warn about using assignments in contexts that requireJohn McCall2009-10-123-48/+77
| | | | | | | | | 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 llvm-svn: 83907
* Diagnose the declaration of explicit specializations after an implicitDouglas Gregor2009-10-124-27/+114
| | | | | | | instantiation has already been required. To do so, keep track of the point of instantiation for anything that can be instantiated. llvm-svn: 83890
* Handle built-in unary operators when reporting ambiguities.Fariborz Jahanian2009-10-122-13/+18
| | | | | | wip - To prune excessive reporting. llvm-svn: 83889
* If built-in operators could not be selected because of ambiguity inFariborz Jahanian2009-10-121-2/+31
| | | | | | | | | | | | | | | | | | 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*(); ^ llvm-svn: 83862
* Types appearing more than once in a spec shouldn't matter.Sebastian Redl2009-10-111-5/+10
| | | | llvm-svn: 83766
* Test exception spec compatibility on return type and parameters.Sebastian Redl2009-10-116-226/+316
| | | | | | | Along the way, use RequireCompleteType when testing exception spec types. Separate all the ugly spec stuff into its own file. llvm-svn: 83764
* Implement the core checking for compatible exception specifications in ↵Sebastian Redl2009-10-104-4/+55
| | | | | | | | | 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. llvm-svn: 83710
* Qualified lookup through using declarations. Diagnose a new type of ambiguity.John McCall2009-10-105-50/+295
| | | | | | | Split the various ambiguous result enumerators into their own enum. Tests for most of C++ [namespace.qual]. llvm-svn: 83700
* Check that the return type is complete when calling a member function.Anders Carlsson2009-10-101-0/+5
| | | | llvm-svn: 83694
* Add CheckCallReturnType and start using it for regular call expressions. ↵Anders Carlsson2009-10-094-11/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | 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; ^ llvm-svn: 83692
* Dead Code EliminationDouglas Gregor2009-10-092-23/+0
| | | | llvm-svn: 83686
* Add some FIXMEsDouglas Gregor2009-10-091-0/+2
| | | | llvm-svn: 83685
* Minor tweaks for code-completion:Douglas Gregor2009-10-092-4/+15
| | | | | | | | | | | - 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. llvm-svn: 83680
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-0914-909/+522
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* When declaring a friend class template, we may end up finding anDouglas Gregor2009-10-091-0/+16
| | | | | | | | 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. llvm-svn: 83672
* Produce good looking diagnostics on ambiguous built-in operators.Fariborz Jahanian2009-10-091-8/+6
| | | | | | | | | | | | | | 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). llvm-svn: 83650
* Use the new API for applying the qualifiers on built-in '->*' Fariborz Jahanian2009-10-091-5/+3
| | | | | | operator's types. llvm-svn: 83648
* Improve on reporting ambiguity involving built-in candidates.Fariborz Jahanian2009-10-092-11/+12
| | | | | | I still don't like it but it is improvement over what we had. llvm-svn: 83603
* - Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS ↵Steve Naroff2009-10-081-1/+1
| | | | | | | | (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. llvm-svn: 83597
* Fix up error reporting when object cannot be constructed Fariborz Jahanian2009-10-081-2/+3
| | | | | | | because of missing default constructor of a member. Fixes pr5154. llvm-svn: 83583
* Installation of Clang libraries and headers, from Axel Naumann!Douglas Gregor2009-10-081-3/+0
| | | | llvm-svn: 83582
* Add code completion support for ObjC property declarations/attributes.Steve Naroff2009-10-082-0/+29
| | | | llvm-svn: 83579
* Implement support for -Wunused-variable, from Oscar Bonilla!Douglas Gregor2009-10-082-3/+12
| | | | llvm-svn: 83577
* Add more testing for the properties of explicit specialization. Douglas Gregor2009-10-081-0/+2
| | | | | | | Also, eliminate a redundant diagnostic by marking a variable declared with incomplete type as an invalid declaration. llvm-svn: 83553
* Don't complain about out-of-line explicit specializations of memberDouglas Gregor2009-10-081-2/+4
| | | | | | | | function and member function templates that are not definitions. Add more tests to ensure that explicit specializations of member function templates prevent instantiation. llvm-svn: 83550
* Improve checking for specializations of member classes of classDouglas Gregor2009-10-085-22/+67
| | | | | | | | | | | 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. llvm-svn: 83547
* For instantiations of static data members of class templates, keepDouglas Gregor2009-10-086-49/+108
| | | | | | | | 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. llvm-svn: 83533
* Make sure to set the template specialization kind of an explicitDouglas Gregor2009-10-082-8/+3
| | | | | | | template instantiation of a member function of a class template. FIXME -= 2; llvm-svn: 83520
* Only perform an implicit instantiation of a function if its templateDouglas Gregor2009-10-081-9/+3
| | | | | | | | | 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). llvm-svn: 83511
OpenPOWER on IntegriCloud