summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Partial and full specializations of a class template may have aDouglas Gregor2010-05-061-0/+2
| | | | | | | | | different tag kind ("struct" vs. "class") than the primary template, which has an affect on access control. Should fix the last remaining Boost.Accumulors failure. llvm-svn: 103144
* When computing the template arguments for the instantiation of aDouglas Gregor2010-05-031-3/+11
| | | | | | | | | | | | | friend function template, be sure to adjust the computed template argument lists based on the location of the definition of the function template: it's possible that the definition we're instantiating with and the template declaration that we found when creating the specialization are in different contexts, which meant that we would end up using the wrong template arguments for instantiation. Fixes PR7013; all Boost.DynamicBitset tests now pass. llvm-svn: 102974
* Clean up our handling of local instantiation scopes, which keep trackDouglas Gregor2010-04-301-26/+36
| | | | | | | | | | | | | | | | | | | | | of the mapping from local declarations to their instantiated counterparts during template instantiation. Previously, we tried to do some unholy merging of local instantiation scopes that involved storing a single hash table along with an "undo" list on the side... which was ugly, and never handled function parameters properly. Now, we just keep separate hash tables for each local instantiation scope, and "combining" two scopes means that we'll look in each of the combined hash tables. The combined scope stack is rarely deep, and this makes it easy to avoid the "undo" issues we were hitting. Also, I've simplified the logic for function parameters: if we're declaring a function and we need the function parameters to live longer, we just push them back into the local instantiation scope where we need them. Fixes PR6990. llvm-svn: 102732
* Introduce a sequence number into class template partialDouglas Gregor2010-04-301-7/+6
| | | | | | | | | | | specializations, which keeps track of the order in which they were originally declared. We use this number so that we can always walk the list of partial specializations in a predictable order during matching or template instantiation. This also fixes a failure in Boost.Proto, where SourceManager::isBeforeInTranslationUnit was behaving poorly in inconsistent ways. llvm-svn: 102693
* Properly switch into the declaring scope of a template when performingJohn McCall2010-04-291-3/+2
| | | | | | | | | | template argument deduction or (more importantly) the final substitution required by such deduction. Makes access control magically work in these cases. Fixes PR6967. llvm-svn: 102572
* Implement template instantiation for Objective-C @catchDouglas Gregor2010-04-261-1/+15
| | | | | | statements. This is the last of the Objective-C statements. llvm-svn: 102356
* Introduce a limit on the depth of the template instantiation backtraceDouglas Gregor2010-04-201-1/+21
| | | | | | | | | | | | | | | | we will print with each error that occurs during template instantiation. When the backtrace is longer than that, we will print N/2 of the innermost backtrace entries and N/2 of the outermost backtrace entries, then skip the middle entries with a note such as: note: suppressed 2 template instantiation contexts; use -ftemplate-backtrace-limit=N to change the number of template instantiation entries shown This should eliminate some excessively long backtraces that aren't providing any value. llvm-svn: 101882
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-191-1/+2
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Make sure that we don't visit redeclarations of nested classes whileDouglas Gregor2010-04-181-1/+4
| | | | | | | | instantiating class members as part of an explicit instantiation. Addresses a compilation problem in Boost.Serialization. llvm-svn: 101725
* When creating the implicitly-declared special member functions, beDouglas Gregor2010-04-121-1/+1
| | | | | | | | sure to introduce them into the current Scope (when we have one) in addition to the DeclContext for the class, so that they can be found by name lookup for inline members of the class. Fixes PR6570. llvm-svn: 101047
OpenPOWER on IntegriCloud