summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-12/+12
| | | | | | No functionality change (really). llvm-svn: 68726
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-9/+8
| | | | | | | | | | | | | | | | | | | | pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. llvm-svn: 67952
* The injected-class-name of class templates and class templateDouglas Gregor2009-03-261-0/+2
| | | | | | | | | | | | | | | | | | specializations can be treated as a template. Finally, we can parse and process the first implementation of Fibonacci I wrote! Note that this code does not handle all of the cases where injected-class-names can be treated as templates. In particular, there's an ambiguity case that we should be able to handle (but can't), e.g., template <class T> struct Base { }; template <class T> struct Derived : Base<int>, Base<char> { typename Derived::Base b; // error: ambiguous typename Derived::Base<double> d; // OK }; llvm-svn: 67720
* Implement template instantiation for static data members of classDouglas Gregor2009-03-251-0/+41
| | | | | | | | | | | | | | | | | | templates, including in-class initializers. For example: template<typename T, T Divisor> class X { public: static const T value = 10 / Divisor; }; instantiated with, e.g., X<int, 5>::value to get the value '2'. llvm-svn: 67715
* Pass access specifiers through to member classes and member enums.Douglas Gregor2009-03-251-0/+1
| | | | llvm-svn: 67710
* Instantiation for member classes of class templates. Note that onlyDouglas Gregor2009-03-251-0/+19
| | | | | | | | | | | the declarations of member classes are instantiated when the owning class template is instantiated. The definitions of such member classes are instantiated when a complete type is required. This change also introduces the injected-class-name into a class template specialization. llvm-svn: 67707
* Stub out some declaration kinds that cannot ever be instantiatedDouglas Gregor2009-03-251-0/+14
| | | | llvm-svn: 67686
* Minor refactoring to eliminate an extra switch during template instantiationDouglas Gregor2009-03-251-3/+9
| | | | llvm-svn: 67684
* Template instantiation for conversion functionsDouglas Gregor2009-03-251-0/+31
| | | | llvm-svn: 67664
* Template instantiation for constructorsDouglas Gregor2009-03-241-0/+45
| | | | llvm-svn: 67623
* More work on diagnosing abstract classes. We can now handle cases likeAnders Carlsson2009-03-241-1/+1
| | | | | | | | | | | | class C { void g(C c); virtual void f() = 0; }; In this case, C is not known to be abstract when doing semantic analysis on g. This is done by recursively traversing the abstract class and checking the types of member functions. llvm-svn: 67594
* Cleanup template instantiation for methods, destructorsDouglas Gregor2009-03-241-53/+107
| | | | llvm-svn: 67585
* Template instantiation for destructors. This is somewhat repetitive;Douglas Gregor2009-03-241-1/+43
| | | | | | eliminating the duplication is next on the list. llvm-svn: 67579
* Template instantiation for the declarations of member functions withinDouglas Gregor2009-03-231-0/+118
| | | | | | | | | | | | | | | | | | | | | | a class template. At present, we can only instantiation normal methods, but not constructors, destructors, or conversion operators. As ever, this contains a bit of refactoring in Sema's type-checking. In particular: - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator (handling the declarator itself) and CheckFunctionDeclaration (checking for the the function declaration), the latter of which is also used by template instantiation. - We were performing the adjustment of function parameter types in three places; collect those into a single new routine. - When the type of a parameter is adjusted, allocate an OriginalParmVarDecl to keep track of the type as it was written. - Eliminate a redundant check for out-of-line declarations of member functions; hide more C++-specific checks on function declarations behind if(getLangOptions().CPlusPlus). llvm-svn: 67575
* Refactor instantiation of declarations within a template into a muchDouglas Gregor2009-03-171-0/+202
cleaner visitor framework. Added a visitor for declarations, which is quite similar to the visitor for statatements. llvm-svn: 67104
OpenPOWER on IntegriCloud