summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Reflow some comments.Mike Stump2009-05-161-5/+5
| | | | llvm-svn: 71936
* Implement a FIXME, we now pass in the locations of the braces for enums.Mike Stump2009-05-161-1/+3
| | | | llvm-svn: 71930
* Make sure that we use the canonical type for the names of instantiatedDouglas Gregor2009-05-151-2/+5
| | | | | | | | | | constructors and destructors. This is a requirement of DeclarationNameTable::getCXXSpecialName that we weren't assert()'ing, so it should have been caught much earlier :( Big thanks to Anders for the test case. llvm-svn: 71895
* Call ActOnStartOfFunctionDecl/ActOnFinishFunctionBody whenDouglas Gregor2009-05-151-4/+5
| | | | | | instantiating the definition of a function from a template. llvm-svn: 71869
* Implement template instantiation for DeclStmtDouglas Gregor2009-05-151-1/+10
| | | | llvm-svn: 71818
* Introduce basic support for instantiating the definitions of memberDouglas Gregor2009-05-141-1/+20
| | | | | | | functions of class templates. Only compound statements and expression statements are currently implemented. llvm-svn: 71814
* Check that the function being overridden is virtual.Anders Carlsson2009-05-141-2/+2
| | | | llvm-svn: 71802
* Introduce a stack of instantiation scopes that are used to store the mapping ↵Douglas Gregor2009-05-141-0/+9
| | | | | | from variable declarations that occur within templates to their instantiated counterparts llvm-svn: 71799
* Link FunctionDecls instantiated from the member functions of a classDouglas Gregor2009-05-141-6/+22
| | | | | | | | template to the FunctionDecls from which they were instantiated. This is a necessary first step to support instantiation of the definitions of such functions, but by itself does essentially nothing. llvm-svn: 71792
* Explicit instantiations of templates now instantiate the definitionsDouglas Gregor2009-05-131-0/+17
| | | | | | | | of class members (recursively). Only member classes are actually instantiated; the instantiation logic for member functions and variables are just stubs. llvm-svn: 71713
* Encapsulate template arguments lists in a new class,Douglas Gregor2009-05-111-26/+14
| | | | | | | | TemplateArgumentList. This avoids the need to pass around pointer/length pairs of template arguments lists, and will eventually make it easier to introduce member templates and variadic templates. llvm-svn: 71517
* Implement the semantics of the injected-class-name within a classDouglas Gregor2009-05-101-3/+0
| | | | | | | | | | | | | | | | | | template. The injected-class-name is either a type or a template, depending on whether a '<' follows it. As a type, the injected-class-name's template argument list contains its template parameters in declaration order. As part of this, add logic for canonicalizing declarations, and be sure to canonicalize declarations used in template names and template arguments. A TagType is dependent if the declaration it references is dependent. I'm not happy about the rather complicated protocol needed to use ASTContext::getTemplateSpecializationType. llvm-svn: 71408
* Replace more release+static_cast with takeAs.Anders Carlsson2009-05-011-1/+1
| | | | llvm-svn: 70567
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* 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