summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* When we are instantiating a member function of a local class, be sureDouglas Gregor2010-01-161-2/+8
| | | | | | | | | to merge the local instantiation scope with the outer local instantiation scope, so that we can instantiate declarations from the function owning the local class. Fixes an assert while instantiating Boost.MPL's BOOST_MPL_ASSERT_MSG. llvm-svn: 93651
* Typedefs can be redeclared. That seems like something we should record inJohn McCall2009-12-301-0/+5
| | | | | | the AST lest we run into some crazy canonicalization bug like PR5874. llvm-svn: 92283
* Egregious, disgusting workaround for PR5866. We need to rework how weDouglas Gregor2009-12-241-2/+5
| | | | | | | | keep track of friends within templates, which will provide a real for PR5866. For now, this makes sure we don't do something entirely stupid with friends of specializations. llvm-svn: 92143
* Add using shadow decls to the "instantiated locals" map, fixing PR5847.John McCall2009-12-221-0/+5
| | | | llvm-svn: 91928
* Patch over yet more problems with friend declarations which were provokingJohn McCall2009-12-171-1/+7
| | | | | | | problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once I settled on how I was going to approach it. llvm-svn: 91633
* Link up member-class redeclarations during template instantiation.John McCall2009-12-151-0/+6
| | | | | | This test courtesy of LLVM. llvm-svn: 91462
* Fix PR5716 by bandaging over the solution until we can come back to it.John McCall2009-12-141-1/+6
| | | | | | I apologize for friend declarations. llvm-svn: 91359
* Improve template instantiation for object constructions in several ways:Douglas Gregor2009-12-141-69/+96
| | | | | | | | | | | | | - During instantiation, drop default arguments from constructor and call expressions; they'll be recomputed anyway, and we don't want to instantiate them twice. - Rewrote the instantiation of variable initializers to cope with non-dependent forms properly. Together, these fix a handful of problems I introduced with the switch to always rebuild expressions from the source code "as written." llvm-svn: 91315
* Rework the way we handle template instantiation forDouglas Gregor2009-12-121-11/+42
| | | | | | | | | | | | | | | | | | | | | | | implicitly-generated AST nodes. We previously built instantiated nodes for each of these AST nodes, then passed them on to Sema, which was not prepared to see already-type-checked nodes (see PR5755). In some places, we had ugly workarounds to try to avoid re-type-checking (e.g., in VarDecl initializer instantiation). Now, we skip implicitly-generated nodes when performing instantiation, preferring instead to build just the AST nodes that directly reflect what was written in the source code. This has several advantages: - We don't need to instantiate anything that doesn't have a direct correlation to the source code, so we can have better location information. - Semantic analysis sees the same thing at template instantiation time that it would see for a non-template. - At least one ugly hack (VarDecl initializers) goes away. Fixes PR5755. llvm-svn: 91218
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-101-20/+53
| | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
* Implement template instantiation for exception specifications. Also,Douglas Gregor2009-12-081-0/+37
| | | | | | | | | | | | | | print exception specifications on function types and declarations. Fixes <rdar://problem/7450999>. There is some poor source-location information here, because we don't track locations of the types in exception specifications. Filed PR5719. Failures during template instantiation of the signature of a function or function template have wrong point-of-instantiation location information. I'll tackle that with a separate commit. llvm-svn: 90863
* Correctly implement the C++03 and 0x restrictions on class-member usingJohn McCall2009-12-081-9/+4
| | | | | | declarations. llvm-svn: 90843
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-14/+14
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-6/+78
| | | | llvm-svn: 90614
* A new helper function to set various bits in the class whenFariborz Jahanian2009-12-031-7/+2
| | | | | | | a new virtual function is declared/instantiated. it is used in couple of places. llvm-svn: 90470
* When we're building a CXXExprWithTemporaries, only include thoseDouglas Gregor2009-12-031-0/+6
| | | | | | | | | | | temporaries that are within our current evaluation context. That way, nested evaluation contexts (e.g., within a sizeof() expression) won't see temporaries from outer contexts. Also, make sure to push a new evaluation context when instantiating the initializer of a variable; this may be an unevaluated context or a potentially-evaluated context, depending on whether it's an in-class initializer or not. Fixes PR5672. llvm-svn: 90460
* Improve source location information for C++ member initializers in aDouglas Gregor2009-12-021-6/+12
| | | | | | | constructor, by keeping the DeclaratorInfo* rather than just the type and a single location. llvm-svn: 90355
* Funtion templates and function template specializations do notDouglas Gregor2009-12-011-2/+0
| | | | | | | override virtual functions. Also, eliminate a (now redundant) call to AddOverriddenMethods. llvm-svn: 90242
* Move the checking of overridden virtual functions into the code pathDouglas Gregor2009-12-011-4/+3
| | | | | | | | | | | | | | | common to both parsing and template instantiation, so that we'll find overridden virtuals for member functions of class templates when they are instantiated. Additionally, factor out the checking for pure virtual functions, so that it will be executed both at parsing time and at template instantiation time. These changes fix PR5656 (for real), although one more tweak w.r.t. member function templates will be coming along shortly. llvm-svn: 90241
* Remove all of Sema's explicit uses of OverloadedFunctionDecl except forJohn McCall2009-11-301-16/+0
| | | | | | those associated with TemplateNames. llvm-svn: 90162
* Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.Benjamin Kramer2009-11-281-2/+1
| | | | llvm-svn: 90044
* Fix a crash when "instantiating" VarDecls that are neither type nor value ↵Anders Carlsson2009-11-241-0/+1
| | | | | | dependent. llvm-svn: 89774
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-11/+7
| | | | | | | | | | locations" into a new class. Use it pervasively throughout Sema. My fingers hurt. llvm-svn: 89638
* Overhaul previous-declaration and overload checking to work on lookup resultsJohn McCall2009-11-181-21/+19
| | | | | | | rather than NamedDecl*. This is a major step towards eliminating OverloadedFunctionDecl. llvm-svn: 89263
* Track overriding methods when instantiating a template class. Fixes PR5550.Sebastian Redl2009-11-181-0/+2
| | | | llvm-svn: 89248
* Split LookupResult into its own header.John McCall2009-11-181-6/+7
| | | | llvm-svn: 89199
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-7/+49
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Implement template instantiation for using directives, which is dead simple.Douglas Gregor2009-11-171-2/+22
| | | | | | | | Also, make the "don't know how to instantiate a particular kind of declaration" diagnostic nicer, so we don't have to trap Clang in a debugger to figure out what went wrong. llvm-svn: 89050
* Instead of hanging a using declaration's target decls directly off the using John McCall2009-11-171-3/+3
| | | | | | | decl, create shadow declarations and put them in scope like normal. Work in progress. llvm-svn: 89048
* Carry lookup configuration throughout lookup on the LookupResult. GiveJohn McCall2009-11-171-5/+8
| | | | | | | | | | | | | LookupResult RAII powers to diagnose ambiguity in the results. Other diagnostics (e.g. access control and deprecation) will be moved to automatically trigger during lookup as part of this same mechanism. This abstraction makes it much easier to encapsulate aliasing declarations (e.g. using declarations) inside the lookup system: eventually, lookup will just produce the aliases in the LookupResult, and the standard access methods will naturally strip the aliases off. llvm-svn: 89027
* If we attempt to add a constructor template specialization that looksDouglas Gregor2009-11-141-17/+16
| | | | | | | | | | | | like a copy constructor to the overload set, just ignore it. This ensures that we don't try to use such a constructor as a copy constructor *without* triggering diagnostics at the point of declaration. Note that we *do* diagnose such copy constructors when explicitly written by the user (e.g., as an explicit specialization). llvm-svn: 88733
* Revert r88718, which does NOT solve the ↵Douglas Gregor2009-11-131-30/+17
| | | | | | constructor-template-as-copy-constructor issue. Big thanks to John for finding this llvm-svn: 88724
* A constructor template cannot be instantiated to a copyDouglas Gregor2009-11-131-17/+30
| | | | | | constructor. Make sure that such declarations can never be formed. llvm-svn: 88718
* Improve diagnostics when a default template argument does not matchDouglas Gregor2009-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | with its corresponding template parameter. This can happen when we performed some substitution into the default template argument and what we had doesn't match any more, e.g., template<int> struct A; template<typename T, template<T> class X = A> class B; B<long> b; Previously, we'd emit a pretty but disembodied diagnostic showing how the default argument didn't match the template parameter. The diagnostic was good, but nothing tied it to the *use* of the default argument in "B<long>". This commit fixes that. Also, tweak the counting of active template instantiations to avoid counting non-instantiation records, such as those we create for (surprise!) checking default arguments, instantiating default arguments, and performing substitutions as part of template argument deduction. llvm-svn: 86884
* Before checking a template template argument against its correspondingDouglas Gregor2009-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | template template parameter, substitute any prior template arguments into the template template parameter. This, for example, allows us to properly check the template template argument for a class such as: template<typename T, template<T Value> class X> struct Foo; The actual implementation of this feature was trivial; most of the change is dedicated to giving decent diagnostics when this substitution goes horribly wrong. We now get a note like: note: while substituting prior template arguments into template template parameter 'X' [with T = float] As part of this change, enabled some very pedantic checking when comparing template template parameter lists, which shook out a bug in our overly-eager checking of default arguments of template template parameters. We now perform only minimal checking of such default arguments when they are initially parsed. llvm-svn: 86864
* Instantiation of template template parameters for nested templates, e.g.,Douglas Gregor2009-11-111-0/+30
| | | | | | | | | template<typename T> struct X { template<template<T Value> class Y> struct Inner; }; llvm-svn: 86844
* Improve instantiation of default template arguments for nestedDouglas Gregor2009-11-091-12/+2
| | | | | | | | | templates. The instantiation of these default arguments must be (and now, is) delayed until the template argument is actually used, at which point we substitute all levels of template arguments concurrently. llvm-svn: 86578
* When transforming an InitListExpr, if we already computed a non-dependent ↵Douglas Gregor2009-11-091-3/+1
| | | | | | type for the InitListExpr, keep it llvm-svn: 86559
* Add hack to make the given testcase work. As far as I can tell, this change isEli Friedman2009-11-091-1/+3
| | | | | | reasonably safe, but it doesn't seem like the right solution. llvm-svn: 86508
* Don't reprocess non-dependent initializers of non-dependent VarDecls. Fixes ↵Sebastian Redl2009-11-081-0/+9
| | | | | | PR5426. llvm-svn: 86460
* When instantiating a field decl, make sure to clone its attributes. With ↵Anders Carlsson2009-11-071-0/+16
| | | | | | this change FileCheck no longer crashes when it's run without any arguments. llvm-svn: 86344
* When determining whether a reference to a static data member is anDouglas Gregor2009-11-011-1/+1
| | | | | | | | | integral constant expression, make sure to find where the initializer was provided---inside or outside the class definition---since that can affect whether we have an integral constant expression (and, we need to see the initializer itself). llvm-svn: 85741
* Implement "incremental" template instantiation for non-type templateDouglas Gregor2009-10-311-6/+28
| | | | | | | | | | | | | | | parameters and template type parameters, which occurs when substituting into the declarations of member templates inside class templates. This eliminates errors about our inability to "reduce non-type template parameter depth", fixing PR5311. Also fixes a bug when instantiating a template type parameter declaration in a member template, where we weren't properly reducing the template parameter's depth. LLVM's StringSwitch header now parses. llvm-svn: 85669
* When a friend is declared in a dependent context, don't even try toDouglas Gregor2009-10-301-2/+3
| | | | | | match it up with a declaration in the outer scope. llvm-svn: 85628
* Instantiate class template friends better; fixes PR5332.Douglas Gregor2009-10-301-1/+8
| | | | llvm-svn: 85612
* Track source information for template arguments and template specializationJohn McCall2009-10-291-12/+12
| | | | | | | types. Preserve it through template instantiation. Preserve it through PCH, although TSTs themselves aren't serializable, so that's pretty much meaningless. llvm-svn: 85500
* Implement support for semantic checking and template instantiation ofDouglas Gregor2009-10-291-2/+205
| | | | | | | | class template partial specializations of member templates. Also, fixes a silly little bug in the marking of "used" template parameters in member templates. Fixes PR5236. llvm-svn: 85447
* Introduce FunctionDecl::isInlined() to tell whether a function shouldDouglas Gregor2009-10-271-1/+1
| | | | | | be inlined. llvm-svn: 85307
* Rename FunctionDecl::isInline/setInline toDouglas Gregor2009-10-271-6/+6
| | | | | | FunctionDecl::isInlineSpecified/setInlineSpecified. llvm-svn: 85305
* Explicit instantiation suppresses the instantiation of non-inlineDouglas Gregor2009-10-271-14/+1
| | | | | | | function template specializations and member functions of class template specializations. llvm-svn: 85300
OpenPOWER on IntegriCloud