summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Several improvements to template argument deduction:Douglas Gregor2009-06-051-1/+2
| | | | | | | | | | | | | | - Once we have deduced template arguments for a class template partial specialization, we use exactly those template arguments for instantiating the definition of the class template partial specialization. - Added template argument deduction for non-type template parameters. - Added template argument deduction for dependently-sized array types. With these changes, we can now implement, e.g., the remove_reference type trait. Also, Daniel's Ackermann template metaprogram now compiles properly. llvm-svn: 72909
* Remove VarDecl from CXXConstructExpr.Anders Carlsson2009-05-301-9/+1
| | | | llvm-svn: 72633
* Bind temporaries correctly when instantiating expressions.Anders Carlsson2009-05-301-1/+1
| | | | llvm-svn: 72632
* Add a CXXBindTemporaryExpr.Anders Carlsson2009-05-301-0/+10
| | | | llvm-svn: 72627
* Reduce the amount of stack space we use in SmallVectors duringDouglas Gregor2009-05-291-2/+2
| | | | | | | template instantiation. This helps reduce our stack footprint when performing deep template instantiations. llvm-svn: 72582
* Simplify, and improve the performance of, template instantiation forDouglas Gregor2009-05-271-2/+1
| | | | | | | | | | | declaration references. The key realization is that dependent Decls, which actually require instantiation, can only refer to the current instantiation or members thereof. And, since the current context during instantiation contains all of those members of the current instantiation, we can simply find the real instantiate that matches up with the "current instantiation" template. llvm-svn: 72486
* Improve name lookup for and template instantiation of declarationDouglas Gregor2009-05-271-18/+10
| | | | | | | | | | | | | | | | | | | | | | | references. There are several smallish fixes here: - Make sure we look through template parameter scope when determining whether we're parsing a nested class (or nested class *template*). This makes sure that we delay parsing the bodies of inline member functions until after we're out of the outermost class (template) scope. - Since the bodies of member functions are always parsed "out-of-line", even when they were declared in-line, teach unqualified name lookup to look into the (semantic) parents. - Use the new InstantiateDeclRef to handle the instantiation of a reference to a declaration (in DeclRefExpr), which drastically simplifies template instantiation for DeclRefExprs. - When we're instantiating a ParmVarDecl, it must be in the current instantiation scope, so only look there. Also, remove the #if 0's and FIXME's from the dynarray example, which now compiles and executes thanks to Anders and Eli. llvm-svn: 72481
* Initial stab at a generalized operation for determining theDouglas Gregor2009-05-271-0/+1
| | | | | | | | | | | | instantiation of a declaration from the template version (or version that lives in a template) and a given set of template arguments. This needs much, much more testing, but it suffices for simple examples like typedef T* iterator; iterator begin(); llvm-svn: 72461
* Template instantiation for "typeof" for both types and expressions.Douglas Gregor2009-05-261-1/+7
| | | | llvm-svn: 72440
* Template instantiation for qualified declaration referenceDouglas Gregor2009-05-221-70/+112
| | | | | | | | | | | | | | | | | | expressions. We are now missing template instantiation logic for only three classes of expressions: - Blocks-related expressions (BlockExpr, BlockDeclRefExpr) - C++ default argument expressions - Objective-C expressions Additionally, our handling of DeclRefExpr is still quite poor, since it cannot handle references to many kinds of declarations. As part of this change, converted the TemplateExprInstantiator to use iteration through all of the expressions via clang/AST/StmtNodes.def, ensuring that we don't forget to add template instantiation logic for any new expression node kinds. llvm-svn: 72303
* Template instantiation for the GNU address-of-label extension.Douglas Gregor2009-05-221-1/+8
| | | | llvm-svn: 72301
* Template instantiation for ExtVectorElementExpr.Douglas Gregor2009-05-221-1/+18
| | | | llvm-svn: 72299
* Add a few tests to ensure that member functions of class templates canDouglas Gregor2009-05-221-1/+6
| | | | | | | call other member functions of class templates, including after template instantiation. No functionality change. llvm-svn: 72282
* Representation of and template instantiation for memberDouglas Gregor2009-05-221-1/+40
| | | | | | | | | | | | expressions. This change introduces another AST node, CXXUnresolvedMemberExpr, that captures member references (x->m, x.m) when the base of the expression (the "x") is type-dependent, and we therefore cannot resolve the member reference yet. Note that our parsing of member references for C++ is still quite poor, e.g., we don't handle x->Base::m or x->operator int. llvm-svn: 72281
* Template instantiation for C99 compound literalsDouglas Gregor2009-05-211-1/+21
| | | | llvm-svn: 72236
* Template instantiation for GNU array-range designators.Douglas Gregor2009-05-211-1/+16
| | | | llvm-svn: 72234
* Template instantiation for C99 designated initializers, because weDouglas Gregor2009-05-211-2/+59
| | | | | | | | can. Also, delay semantic analysis of initialization for value-dependent as well as type-dependent expressions, since we can't always properly type-check a value-dependent expression. llvm-svn: 72233
* Template instantiation for initializer listsDouglas Gregor2009-05-211-1/+15
| | | | llvm-svn: 72229
* Template instantiation for unary type traits, e.g., __is_podDouglas Gregor2009-05-211-1/+18
| | | | llvm-svn: 72220
* Template instantiation for C++ "typeid" expressions.Douglas Gregor2009-05-211-1/+33
| | | | llvm-svn: 72218
* Template instantiation for C++ throw expressionsDouglas Gregor2009-05-211-1/+13
| | | | llvm-svn: 72217
* Template instantiation for C++ delete expressionDouglas Gregor2009-05-211-1/+13
| | | | llvm-svn: 72216
* Merge the ASTVector and ASTOwningVector templates, since they offeredDouglas Gregor2009-05-211-11/+4
| | | | | | | | redundant functionality. The result (ASTOwningVector) lives in clang/Parse/Ownership.h and is used by both the parser and semantic analysis. No intended functionality change. llvm-svn: 72214
* Template instantiation for C++ "new" expressions.Douglas Gregor2009-05-211-1/+56
| | | | llvm-svn: 72199
* Fix template instantiation for compound statements so that it properlyDouglas Gregor2009-05-201-2/+2
| | | | | | | passes the "isStmtExpr" flag, to suppress warnings about unused expressions. llvm-svn: 72190
* Introduce a new kind of RAII class, ASTOwningVector, which is anDouglas Gregor2009-05-201-72/+36
| | | | | | | | llvm::SmallVector that owns all of the AST nodes inside of it. This RAII class is used to ensure proper destruction of AST nodes when template instantiation fails. llvm-svn: 72186
* Template instantiation for CXXExprWithTemporaries, which occurs whenDouglas Gregor2009-05-201-1/+13
| | | | | | | | | | temporaries are generated for some object-constructing expressions in templates that are not type-dependent. Also, be sure to introduce the variable from a CXXConditionDeclExpr into the set of instantiated local variables. llvm-svn: 72185
* Template instantiation for the various kinds of AST nodes that occurDouglas Gregor2009-05-201-3/+84
| | | | | | due to C++ type construction of the form T(a1, a2, ..., aN). llvm-svn: 72183
* Introduce a new expression type, CXXUnresolvedConstructExpr, toDouglas Gregor2009-05-201-0/+41
| | | | | | | | | | | | | | | | | | describe the construction of a value of a given type using function syntax, e.g., T(a1, a2, ..., aN) when the type or any of its arguments are type-dependent. In this case, we don't know what kind of type-construction this will be: it might construct a temporary of type 'T' (which might be a class or non-class type) or might perform a conversion to type 'T'. Also, implement printing of and template instantiation for this new expression type. Due to the change in Sema::ActOnCXXTypeConstructExpr, our existing tests cover template instantiation of this new expression node. llvm-svn: 72176
* Add FIXMEs for the remaining C and C++ expression types that stillDouglas Gregor2009-05-191-2/+24
| | | | | | | need template instantiation logic. Remove one FIXME by instantiating the callee in a non-type-dependent CXXOperatorCallExpr. llvm-svn: 72145
* Template instantiation for __builtin_va_arg.Douglas Gregor2009-05-191-3/+27
| | | | llvm-svn: 72144
* Template instantiation for __builtin_choose_expr.Douglas Gregor2009-05-191-0/+20
| | | | llvm-svn: 72143
* Ban the use of __builtin_types_compatible_p in C++; g++ doesn't support it,Douglas Gregor2009-05-191-16/+2
| | | | | | and it isn't clear exactly what it's supposed to mean. Thanks Eli! llvm-svn: 72142
* Template instantiation for __builtin_shufflevector.Douglas Gregor2009-05-191-0/+48
| | | | llvm-svn: 72139
* Template instantiation for __builtin_types_compatible_p.Douglas Gregor2009-05-191-0/+21
| | | | llvm-svn: 72134
* Template instantiation for GNU statement expressionsDouglas Gregor2009-05-191-0/+12
| | | | llvm-svn: 72129
* Fix handling of the GNU "t ? : f" extension to the conditionalDouglas Gregor2009-05-191-8/+8
| | | | | | | operator in C++, and verify that template instantiation for the condition operator does the right thing. llvm-svn: 72127
* Template instantiation for compound assignment operators.Douglas Gregor2009-05-191-0/+7
| | | | llvm-svn: 72126
* Template instantiation for cast expressions.Douglas Gregor2009-05-191-0/+121
| | | | llvm-svn: 72119
* Template instantiation for call expressions.Douglas Gregor2009-05-191-9/+56
| | | | llvm-svn: 72081
* Template instantiation for array subscript expressions. This was farDouglas Gregor2009-05-191-0/+31
| | | | | | | easier than expected because of the limitation that subscript operators must be member functions. llvm-svn: 72076
* Template instantiation for imaginary literals, because they were next in Expr.hDouglas Gregor2009-05-181-0/+6
| | | | llvm-svn: 72058
* Implement instantiation of a few boring, simple expressions. I don't think ↵Sebastian Redl2009-05-161-2/+44
| | | | | | these are testable yet, though. llvm-svn: 71953
* Reflow some comments.Mike Stump2009-05-161-5/+5
| | | | llvm-svn: 71936
* Template instantiation for WhileStmt and CXXConditionDeclExpr.Douglas Gregor2009-05-151-0/+16
| | | | llvm-svn: 71896
* Allow instantiation of NULL expressions and statementsDouglas Gregor2009-05-151-0/+3
| | | | llvm-svn: 71889
* Instantiation support for 'this'Anders Carlsson2009-05-151-0/+12
| | | | llvm-svn: 71886
* Move statement instantiation into its own file. No functionality changeDouglas Gregor2009-05-151-132/+2
| | | | llvm-svn: 71872
* Instantiate return statements.Anders Carlsson2009-05-151-0/+14
| | | | llvm-svn: 71825
* Add NullStmt::Clone and use itAnders Carlsson2009-05-151-1/+1
| | | | llvm-svn: 71823
OpenPOWER on IntegriCloud