summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-9/+22
| | | | llvm-svn: 129567
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-1/+3
| | | | | | draft standard (N3291). llvm-svn: 129541
* Implement instantiation of noexcept spec and add a test case.Sebastian Redl2011-03-141-1/+7
| | | | llvm-svn: 127603
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-11/+9
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Fixed InnerLocStart.Abramo Bagnara2011-03-091-7/+7
| | | | llvm-svn: 127330
* Teach libclang's token-annotation logic about context-sensitiveDouglas Gregor2011-03-081-2/+4
| | | | | | keywords for Objective-C+ and C++0x. llvm-svn: 127253
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-081-1/+2
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-7/+11
| | | | llvm-svn: 127225
* We may fail to map a declaration in a template to its instantiatedDouglas Gregor2011-03-061-7/+26
| | | | | | | | | | | declaration because of interesting ordering dependencies while instantiating a class template or member class thereof. Complain, rather than asserting (+Asserts) or silently rejecting the code (-Asserts). Fixes the crash-on-invalid in PR8965. llvm-svn: 127129
* Completed source ranges fixes for all classes inheriting from TypeDecl.Abramo Bagnara2011-03-061-3/+3
| | | | llvm-svn: 127120
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-3/+4
| | | | llvm-svn: 127119
* Reinstate r127112, "Propagate new-style exception spec information to ↵Sebastian Redl2011-03-061-2/+3
| | | | | | ExtProtoInfo.", this time with the missing header. llvm-svn: 127118
* Revert r127112, "Propagate new-style exception spec information to ↵NAKAMURA Takumi2011-03-061-3/+2
| | | | | | | | ExtProtoInfo." It seems missing "clang/Basic/ExceptionSpecificationType.h". llvm-svn: 127115
* Propagate new-style exception spec information to ExtProtoInfo.Sebastian Redl2011-03-051-2/+3
| | | | llvm-svn: 127112
* After an error of any kind has occurred, don't assert when attemptingDouglas Gregor2011-03-041-3/+5
| | | | | | | | | | to find the instantiated declaration within a template instantiation fails to do so. It's likely that the original instantiation got dropped due to instantiation failures, which doesn't actually break the invariants of the AST. This eliminates a number of crash-on-invalid failures, e.g., PR9300. llvm-svn: 127030
* Patch up several Sema::FindInstantiatedDecl() callers, so that they'llDouglas Gregor2011-03-041-8/+30
| | | | | | properly cope with NULL return values. llvm-svn: 127024
* Make sure to put template parameters into their owning template'sDouglas Gregor2011-03-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DeclContext once we've created it. This mirrors what we do for function parameters, where the parameters start out with translation-unit context and then are adopted by the appropriate DeclContext when it is created. Also give template parameters public access and make sure that they don't show up for the purposes of name lookup. Fixes PR9400, a regression introduced by r126920, which implemented substitution of default template arguments provided in template template parameters (C++ core issue 150). How on earth could the DeclContext of a template parameter affect the handling of default template arguments? I'm so glad you asked! The link is Sema::getTemplateInstantiationArgs(), which determines the outer template argument lists that correspond to a given declaration. When we're instantiating a default template argument for a template template parameter within the body of a template definition (not it's instantiation, per core issue 150), we weren't getting any outer template arguments because the context of the template template parameter was the translation unit. Now that the context of the template template parameter is its owning template, we get the template arguments from the injected-class-name of the owning template, so substitution works as it should. llvm-svn: 127004
* Fix PR9390 in not one, but two ways:Douglas Gregor2011-03-031-1/+1
| | | | | | | | | | | | | | 1) When we do an instantiation of the injected-class-name type, provide a proper source location. This is just plain good hygiene. 2) When we're building a NestedNameSpecifierLoc from a CXXScopeSpec, only return an empty NestedNameSpecifierLoc if there's no representation. Both problems contributed to the horrible test case in PR9390 that I couldn't reduce down to something palatable. llvm-svn: 126961
* Push nested-name-specifier source location information into namespaceDouglas Gregor2011-02-251-3/+2
| | | | | | aliases. llvm-svn: 126496
* Push nested-name-specifier source location information into using directives.Douglas Gregor2011-02-251-2/+3
| | | | llvm-svn: 126489
* Maintain nested-name-specifier source-location information throughDouglas Gregor2011-02-251-23/+17
| | | | | | instantiation of using declarations (all three forms). llvm-svn: 126485
* Use NestedNameSpecifierLoc within out-of-line variables, function, andDouglas Gregor2011-02-251-51/+51
| | | | | | | tag definitions. Also, add support for template instantiation of NestedNameSpecifierLocs. llvm-svn: 126470
* Update UsingDecl, UnresolvedUsingTypenameDecl, andDouglas Gregor2011-02-251-16/+16
| | | | | | | | | | | | | | UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the extremely-lossy NestedNameSpecifier/SourceRange pair it used to use, improving source-location information. Various infrastructure updates to support NestedNameSpecifierLoc: - AST/PCH (de-)serialization - Recursive AST visitor - libclang traversal (including the first tests of this functionality) llvm-svn: 126459
* Retain complete source-location information for C++Douglas Gregor2011-02-241-6/+6
| | | | | | | | | | | | nested-name-specifiers throughout the parser, and provide a new class (NestedNameSpecifierLoc) that contains a nested-name-specifier along with its type-source information. Right now, this information is completely useless, because we don't actually store the source-location information anywhere in the AST. Call this Step 1/N. llvm-svn: 126391
* Tweak the CXXScopeSpec API a bit, so that we require theDouglas Gregor2011-02-241-12/+6
| | | | | | nested-name-specifier and source range to be set at the same time. llvm-svn: 126347
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-3/+5
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* Step #2/N of __label__ support: keep pushing LabelDecl forward,Chris Lattner2011-02-171-5/+24
| | | | | | | | | | making them be template instantiated in a more normal way and make them handle attributes like other decls. This fixes the used/unused label handling stuff, making it use the same infrastructure as other decls. llvm-svn: 125771
* Inline LocalInstantiationScope::getInstantiationOf into its oneChris Lattner2011-02-171-1/+10
| | | | | | client, making room for future hacking. llvm-svn: 125770
* Change the context correctly when instantiating a static data member definition.John McCall2011-02-141-3/+3
| | | | llvm-svn: 125517
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-3/+2
| | | | | | | | | | | | | | | | | | | | | | access-control diagnostics which arise from the portion of the declarator following the scope specifier, just in case access is granted by friending the individual method. This can also happen with in-line member function declarations of class templates due to templated-scope friend declarations. We were really playing fast-and-loose before with this sort of thing, and it turned out to work because *most* friend functions are in file scope. Making us delay regardless of context exposed several bugs with how we were manipulating delay. I ended up needing a concept of a context that's independent of the declarations in which it appears, and then I actually had to make some things save contexts correctly, but delay should be much cleaner now. I also encapsulated all the delayed-diagnostics machinery in a single subobject of Sema; this is a pattern we might want to consider rolling out to other components of Sema. llvm-svn: 125485
* The code trying to assign a typedef to an anonymous tag declaration wasJohn McCall2011-02-011-7/+9
| | | | | | | | extremely rambunctious, both on parsing and on template instantiation. Calm it down, fixing an internal consistency assert on anonymous enum instantiation manglings. llvm-svn: 124653
* Use attributes for all the override control specifiers.Anders Carlsson2011-01-241-2/+0
| | | | llvm-svn: 124122
* Sema: process non-inheritable attributes on function declarations earlyPeter Collingbourne2011-01-211-6/+2
| | | | | | | This allows us to simplify the handling for the overloadable attribute, removing a number of FIXMEs. llvm-svn: 123961
* 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
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-191-17/+129
| | | | | | | | | | | | | | | | | | | | | 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
* Handle substitutions into function parameter packs whose patternsDouglas Gregor2011-01-141-1/+1
| | | | | | contain multiple parameter packs at different levels. llvm-svn: 123488
* When we're instantiating a direct variable initializer that has a packDouglas Gregor2011-01-141-6/+6
| | | | | | | | expansion in it, we may end up instantiating to an empty expression-list. In this case, the variable is uninitialized; tweak the instantiation logic to handle this case. Fixes PR8977. llvm-svn: 123449
* Keep track of the number of expansions to be produced from a type packDouglas Gregor2011-01-141-5/+8
| | | | | | | | | | | | | | | | | | | | | | | expansion, when it is known due to the substitution of an out parameter pack. This allows us to properly handle substitution into pack expansions that involve multiple parameter packs at different template parameter levels, even when this substitution happens one level at a time (as with partial specializations of member class templates and the signatures of member function templates). Note that the diagnostic we provide when there is an arity mismatch between an outer parameter pack and an inner parameter pack in this case isn't as clear as the normal diagnostic for an arity mismatch. However, this doesn't matter because these cases are very, very rare and (even then) only typically occur in a SFINAE context. The other kinds of pack expansions (expression, template, etc.) still need to support optional tracking of the number of expansions, and we need the moral equivalent of SubstTemplateTypeParmPackType for substituted argument packs of template template and non-type template parameters. llvm-svn: 123448
* When mapping from a function parameter pack to the set of functionDouglas Gregor2011-01-111-3/+4
| | | | | | | | | parameters it expanded to, map exactly the number of function parameters that were expanded rather than just running to the end of the instantiated parameter list. This finishes the implementation of the last sentence of C++0x [temp.deduct.call]p1. llvm-svn: 123213
* Implement the last bullet of [temp.deduct.type]p5 and part of the lastDouglas Gregor2011-01-111-0/+2
| | | | | | | | | sentence of [temp.deduct.call]p1, both of which concern the non-deducibility of parameter packs not at the end of a parameter-type-list. The latter isn't fully implemented yet; see the new FIXME. llvm-svn: 123210
* Work-in-progress implementation of C++0x [temp.arg.explicit]p9, whichDouglas Gregor2011-01-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | allows an argument pack determines via explicit specification of function template arguments to be extended by further, deduced arguments. For example: template<class ... Types> void f(Types ... values); void g() { f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int } There are a number of FIXMEs in here that indicate places where we need to implement + test retained expansions, plus a number of other places in deduction where we need to correctly cope with the explicitly-specified arguments when deducing an argument pack. Furthermore, it appears that the RecursiveASTVisitor needs to be auditied; it's missing some traversals (especially w.r.t. template arguments) that cause it not to find unexpanded parameter packs when it should. The good news, however, is that the tr1::tuple implementation now works fully, and the tr1::bind example (both from N2080) is actually working now. llvm-svn: 123163
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-1/+1
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* When instantiating the arguments to an initializer, use theDouglas Gregor2011-01-071-30/+4
| | | | | | | TreeTransform version of TransformExprs() rather than explicit loop, so that we expand pack expansions properly. Test cast coming soon... llvm-svn: 123014
* Implement substitution of a function parameter pack for its set ofDouglas Gregor2011-01-071-17/+50
| | | | | | | | | | | | | | | | | | | | | | | | instantiated function parameters, enabling instantiation of arbitrary pack expansions involving function parameter packs. At this point, we can now correctly compile a simple, variadic print() example: #include <iostream> #include <string> void print() {} template<typename Head, typename ...Tail> void print(const Head &head, const Tail &...tail) { std::cout << head; print(tail...); } int main() { std::string hello = "Hello"; print(hello, ", world!", " ", 2011, '\n'); } llvm-svn: 123000
* Implement support for template template parameter packs, e.g.,Douglas Gregor2011-01-051-2/+2
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-1/+65
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-1/+2
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-18/+7
| | | | | | | | | | | pattern is a template argument, which involves repeatedly deducing template arguments using the pattern of the pack expansion, then bundling the resulting deductions into an argument pack. We can now handle a variety of simple list-handling metaprograms using variadic templates. See, e.g., the new "count" metaprogram. llvm-svn: 122439
* Implement instantiation of pack expansions whose pattern is a type-idDouglas Gregor2010-12-211-0/+55
| | | | | | in an exception specification. llvm-svn: 122297
OpenPOWER on IntegriCloud