summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When instantiating a non-type template parameter pack, be sure toDouglas Gregor2010-12-241-4/+14
| | | | | | | | extract the appropriate argument from the argument pack (based on the current substitution index, of course). Simple instantiation of pack expansions involving non-type template parameter packs now works. llvm-svn: 122532
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-3/+4
| | | | | | | | | | | 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
* When searching for the instantiation of a locally-scoped tagDouglas Gregor2010-12-211-5/+15
| | | | | | | declaration, also look for an instantiation of its previous declarations. Fixes PR8801. llvm-svn: 122361
* Implement instantiation of pack expansions whose pattern is a type-idDouglas Gregor2010-12-211-74/+8
| | | | | | in an exception specification. llvm-svn: 122297
* Handle instantiation of template type parameter packs that occur asDouglas Gregor2010-12-201-2/+18
| | | | | | | the first qualifier in scope. We can't adequately test this test, unfortunately. llvm-svn: 122283
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-201-5/+102
| | | | | | | | | | | | | | | | | whose patterns are template arguments. We can now instantiate, e.g., typedef tuple<pair<OuterTypes, InnerTypes>...> type; where OuterTypes and InnerTypes are template type parameter packs. There is a horrible inefficiency in TemplateArgumentLoc::getPackExpansionPattern(), where we need to create copies of TypeLoc data because our interfaces traffic in TypeSourceInfo pointers where they should traffic in TypeLocs instead. I've isolated in efficiency in this one routine; once we refactor our interfaces to traffic in TypeLocs, we can eliminate it. llvm-svn: 122278
* Added missing IgnoreParens().Abramo Bagnara2010-12-141-1/+1
| | | | llvm-svn: 121795
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-201-1/+1
| | | | llvm-svn: 119886
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-13/+11
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Replace one hack with a different hack: strip out the ObjectTypeJohn McCall2010-11-121-10/+6
| | | | | | | | | parameters to the Transform*Type functions and instead call out the specific cases where an object type and the unqualified lookup results are important. Fixes an assert and failed compile on a testcase from PR7248. llvm-svn: 118887
* Instantiate class member template partial specialization declarationsDouglas Gregor2010-11-101-2/+23
| | | | | | | | | in the order they occur within the class template, delaying out-of-line member template partial specializations until after the class has been fully instantiated. This fixes a regression introduced by r118454 (itself a fix for PR8001). llvm-svn: 118704
* Use the real keyword location when rebuilding an elaborated type instead ofJohn McCall2010-11-041-5/+7
| | | | | | making something up. Fixes PR8129. llvm-svn: 118258
* Don't instantiate members not belonging in the semantic context of the template.Argyrios Kyrtzidis2010-11-041-0/+12
| | | | | | | | | | | | | | | e.g. for: template <int i> class A { class B *g; }; 'class B' has the template as lexical context but semantically it is introduced in namespace scope. Fixes rdar://8611125 & http://llvm.org/PR8505 llvm-svn: 118235
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-261-3/+3
| | | | | | anymore. llvm-svn: 117357
* Teach the warning about unnamed/local types in template arguments toDouglas Gregor2010-10-131-6/+0
| | | | | | | actually walk the template argument type to find any unnamed/local types within it. Fixes PR6784. llvm-svn: 116382
* Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor2010-10-121-17/+38
| | | | | | | | | | | | | | | that are suppressed during template argument deduction. This change queues diagnostics computed during template argument deduction. Then, if the resulting function template specialization or partial specialization is chosen by overload resolution or partial ordering (respectively), we will emit the queued diagnostics at that point. This addresses most of PR6784. However, the check for unnamed/local template arguments (which existed before this change) is still only skin-deep, and needs to be extended to look deeper into types. It must be improved to finish PR6784. llvm-svn: 116373
* If we end up instantiating a function parameter whose default argumentDouglas Gregor2010-10-121-0/+3
| | | | | | | | | has not yet been parsed, note that the default argument hasn't been parsed and keep track of all of the instantiations of that function parameter. When its default argument does get parsed, imbue the instantiations with that default argument. Fixes PR8245. llvm-svn: 116324
* Reinstate r114925 and r114929, both steps towardDouglas Gregor2010-09-281-7/+0
| | | | | | <rdar://problem/8459981>. llvm-svn: 114984
* Temporarily revert 114929 114925 114924 114921. It looked like they (or at leastBill Wendling2010-09-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one of them) was causing a series of failures: http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/4518 svn merge -c -114929 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114929 into '.': U include/clang/Sema/Sema.h U include/clang/AST/DeclCXX.h U lib/Sema/SemaDeclCXX.cpp U lib/Sema/SemaTemplateInstantiateDecl.cpp U lib/Sema/SemaDecl.cpp U lib/Sema/SemaTemplateInstantiate.cpp U lib/AST/DeclCXX.cpp svn merge -c -114925 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114925 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/AST/DeclCXX.cpp svn merge -c -114924 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114924 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp U lib/AST/ASTContext.cpp svn merge -c -114921 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114921 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp llvm-svn: 114933
* Centralize the management of CXXRecordDecl::DefinitionData'sDouglas Gregor2010-09-281-7/+0
| | | | | | | | | | | HasTrivialConstructor, HasTrivialCopyConstructor, HasTrivialCopyAssignment, and HasTrivialDestructor bits in CXXRecordDecl's methods. This completes all but the Abstract bit and the set of conversion functions, both of which will require a bit of extra work. The majority of <rdar://problem/8459981> is now implemented (but not all of it). llvm-svn: 114929
* Correctly set "explicit template instantiation" kind on inner structs of ↵Nico Weber2010-09-271-4/+11
| | | | | | | | templates whose explicit instantiation is first declared and then defined. Fixes http://llvm.org/pr8207 llvm-svn: 114874
* Simplify template instantiation for C++ exception declarations,Douglas Gregor2010-09-091-7/+5
| | | | | | eliminating an unnecessary use of TemporaryBase in the process. llvm-svn: 113500
* One who seeks knowledge learns something new every day.John McCall2010-08-261-2/+2
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* Move more stuff out of Sema.h.John McCall2010-08-251-5/+6
| | | | llvm-svn: 112026
* Struggle mightily against header inclusion in Sema.h.John McCall2010-08-241-0/+1
| | | | llvm-svn: 111904
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-12/+12
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* DeclPtrTy -> Decl *John McCall2010-08-211-3/+3
| | | | llvm-svn: 111733
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-1/+1
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
* Added locations and type source info for DeclarationName.Abramo Bagnara2010-08-111-0/+9
| | | | llvm-svn: 110860
* Instantiate attributes from the pattern record when instantiatingJohn McCall2010-08-011-0/+3
| | | | | | a class template. Fixes rdar://problem/8243419. llvm-svn: 109967
* Add source location information to C++ base specifiers.Nick Lewycky2010-07-261-8/+6
| | | | llvm-svn: 109396
* Kill off the last Destroy method in the AST libraryDouglas Gregor2010-07-251-6/+0
| | | | llvm-svn: 109378
* Fix http://llvm.org/PR7660Argyrios Kyrtzidis2010-07-191-1/+2
| | | | | | | A ParmVarDecl instantiated from a FunctionProtoType may have Record as DeclContext, in which case isStaticDataMember() will erroneously return true. llvm-svn: 108692
* Set DeclContext of ParamVarDecl only. No needFariborz Jahanian2010-07-131-2/+1
| | | | | | | to set that of VarDecl for block variables (they are already set). Per Doug's comment. llvm-svn: 108273
* More block instantiation stuff. Set variable/param DeclContextFariborz Jahanian2010-07-131-0/+4
| | | | | | to block context when first instantiating them. llvm-svn: 108266
* When performing substitution of template arguments within the body ofDouglas Gregor2010-07-081-1/+11
| | | | | | | a template, be sure to include the template arguments from the injected-class-name. Fixes PR7587. llvm-svn: 107895
* Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis2010-07-071-2/+2
| | | | | | | | of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". llvm-svn: 107768
* Fix multiple emission of the this-> fixit for each instantiation by fixing theNick Lewycky2010-07-061-0/+8
| | | | | | AST during the instantiation. Fixes PR7417! llvm-svn: 107690
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-1/+1
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Revert r106099; it broke self-host.Douglas Gregor2010-06-161-6/+1
| | | | llvm-svn: 106100
* Added TemplateTypeParmType::getDecl().Abramo Bagnara2010-06-161-1/+6
| | | | llvm-svn: 106099
* Make sure that we instantiate variably modified types, even if theyDouglas Gregor2010-05-241-5/+7
| | | | | | aren't dependent. Fixes <rdar://problem/8020206>. llvm-svn: 104511
* Revert r104106; it's breaking linking of Boost.Serialization.Douglas Gregor2010-05-191-3/+1
| | | | llvm-svn: 104121
* Teach clang to instantiate attributes on more declarations. Fixes PR7102.Douglas Gregor2010-05-191-1/+3
| | | | llvm-svn: 104106
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* Whenever we instantiate a function definition or class, enter a newDouglas Gregor2010-05-121-0/+2
| | | | | | | potentially-evaluated expression context, to ensure that used declarations get properly marked. Fixes PR7123. llvm-svn: 103624
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-10/+16
| | | | llvm-svn: 103517
* When we encounter a non-dependent type during template instantiation,Douglas Gregor2010-05-071-3/+12
| | | | | | | mark any declarations we see inside of that type as "referenced". Fixes PR7079. llvm-svn: 103323
OpenPOWER on IntegriCloud